See also LongMappedMapper.

-------------------------------------
David Pollak<feeder.of.the.be...@gmail.com> wrote:

Makes sense.  Please open a ticket: http://github.com/dpp/liftweb/issues

On Thu, Nov 5, 2009 at 6:44 AM, Jean-Adrien <jean.vauc...@gmail.com> wrote:

>
> Hello,
>
> I have a question regarding the .obj field in MappedForeignKey trait;
> If I load a persisted object, if see that I can modify the value of
> one MappedForeignKey column, and the change is not reflected in .obj
> method. Doesn't it make sense to have the updated value, since the .is
> method returns the updated foreign key:
>
> val testUser : User = User.find(By(User.id, 1)).open_!
> val testAddress = testUser.homeAddress.obj;
> Log.debug("Current FK id is "+testUser.homeAddress.is) // returns 1
>
> testAddress match {
>      case Full(addr) =>
>         val anotherAddr : Address = Address.find(By(Address.id,
> 2)).open_!
>         Log.debug("There was an address: "+addr+". Replace it with
> addr id#2: "+anotherAddr);
>          testUser.homeAddress(anotherAddr).save
>
>      case _ =>
>        [...]
>    }
>    val retestAddress = testUser.homeAddress.obj
>    Log.debug("Now obj is "+retestAddress); // returns a Box with the
> old address (former id)
>    Log.debug("And is is "+testUser.homeAddress.is) // returns 2
>
> By the way, what is the best method to reload the changes, if, i.e. I
> have no reference on the query that produced the original (parent)
> object (e.g. testUser), and therefore no way to reload it
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to