We're working on a Seam application for an educational project and are 
experiencing problems when dealing with (what I would call) "just-created 
instances".

When we ask for the value of the primary key of an instance that has just been 
created (in other words: that has NOT been retrieved from or stored to the 
database), it's value is always 0. 

This primary key though, is an auto-increment field in the MySQL database. 
While the value of this field in the persistence context is 0, the value is 
stored correctly in the database (i.e. not 0).

I thought it might be good to update the instance manually with the new data, 
but since the value of the identifying field of the instance is 0, a call to 
entityManager.refresh(instance) results in an EntityNotFoundException.

Unfortunately, the wrong value in the persistence context raises a problem 
while trying to add another instance of the same type. Then the application 
will try to figure out if an instance with the identifier of the instance to be 
added already exists and reports positively of course. This makes it impossible 
to add a second instance w/o returning to the main screen of the application 
and starting over again.

After reading through many topics on this forum, I began to think that it might 
have something to do with the mysql-get-generated-keys entity-command of 
Hibernate, but I can't figure out what the Seam-equivalent of this setting 
would be or whether this is relevant at all when Seam is being used....

The application is based upon a framework generated by the reverse engineering 
tool. We're using Jboss 4.0.4RC1. We've tried Seam 1.0 beta 2 as well as Seam 
1.0.0 CR2.

I hope that someone can make things a bit more clear for me or perhaps point me 
to some place where I can find more information on this particular subject.

Thanks much in advance!

Cheers, Remco

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3945859#3945859

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3945859


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to