[Lift] Re: Getting the generated id from a mapper instance

2009-07-05 Thread Spencer Uresk

Yep, it appears that was the mistake I somehow made.

Thanks!

- Spencer

On Jul 4, 2009, at 6:21 PM, Peter Robinett wrote:


 I think I got the same thing once before when referring to the
 companion object (singleton) instead of my specific instance. Perhaps
 you're doing the same thing?

 Peter Robinett

 On Jul 4, 2:14 am, Spencer Uresk sur...@gmail.com wrote:
 I'm having a bit of trouble with a mapper class I'm trying to make.
 Everything is working fine, except that I cannot get the id of the
 newly-saved class - it always returns the default value (-1L). Here  
 is
 what my class looks like:

 object Job extends Job with LongKeyedMetaMapper[Job] {

 }

 class Job extends LongKeyedMapper[Job] with IdPK {
 .. fields here...

 }

 Here is the save code I am trying:

 job.save
 Log.info(JOB ID:  + job.id)

 I've also tried:

 job.save
 val newJob = job.reload
 Log.info(JOB ID: + newJob.id)

 I'm using mySQL 5.1.

 Any ideas on why I'm never seeing the generated key, and what the
 correct approach would be?

 Thanks,

 - Spencer
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: Getting the generated id from a mapper instance

2009-07-04 Thread Peter Robinett

I think I got the same thing once before when referring to the
companion object (singleton) instead of my specific instance. Perhaps
you're doing the same thing?

Peter Robinett

On Jul 4, 2:14 am, Spencer Uresk sur...@gmail.com wrote:
 I'm having a bit of trouble with a mapper class I'm trying to make.  
 Everything is working fine, except that I cannot get the id of the  
 newly-saved class - it always returns the default value (-1L). Here is  
 what my class looks like:

 object Job extends Job with LongKeyedMetaMapper[Job] {

 }

 class Job extends LongKeyedMapper[Job] with IdPK {
 .. fields here...

 }

 Here is the save code I am trying:

 job.save
 Log.info(JOB ID:  + job.id)

 I've also tried:

 job.save
 val newJob = job.reload
 Log.info(JOB ID: + newJob.id)

 I'm using mySQL 5.1.

 Any ideas on why I'm never seeing the generated key, and what the  
 correct approach would be?

 Thanks,

 - Spencer
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---