Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Databases
»
Object Relational Mapping
org.hibernate.NonUniqueObjectException
Singh Harmeet
,
Ranch Hand
Nov 30, 2012 02:50:59
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
i was try to generate the org.hibernate.NonUniqueObjectException exception , but there is not exception generated . there is follwing code
User user1 = new User(); user1.setId(9); user1.setLoginName("HardeepSingh"); session.saveOrUpdate(user1); session.evict(user1); User user = (User) session.get(User.class, 9); user.setLoginName("singhHardeep0013"); user.setPassword("paswd"); user.setName("Hardeep Singh"); user.setEmailAddress("Hardeepsingh.0013@gmail.com"); user.setVerified(true); user.setLassAccess(new Date()); user.setRegestrationTime(new GregorianCalendar());
Bill Gorder
,
Bartender
staff
Dec 12, 2012 19:08:22
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
You cannot have 2 objects with the same persistent id in the context at the same time or you get this exception. In your example this does not happen.
Here is a blog that explains it a bit
http://kousikraj.wordpress.com/2010/12/31/hibernate-non-unique-object-exception/
Post by:
autobot
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 959 times.
Similar Threads
Doubt in an Object instance while using evict() method
how to refactor this method ?
Problem in Adding Attributes to TLD file
Hibernate Query
Test duplication on db with exception...am I on the right track?
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:55:48
.