Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] question about readObject(Object object) method in Session class

It should be 2, it appears that you may have corrupted your cache.  Are you
modifying an object that is returned from the Session?



bozhou tao wrote:
> 
> 
> Hi,
> I'm now using Eclipselink as the persistence provider of Toplink in my
> project and for some reason I need to use the readObject(Object object)
> method of the Session class.According to the document:java.lang.Object
> readObject(java.lang.Object object)
>                             throws DatabaseExceptionPUBLIC: Use the
> example object to construct a read object query by the objects primary
> key. This will read the object from the database with the same primary key
> as the object or null if no object is found.However, when I call this
> method in my code, the result is not as I expected. Take the code below
> for example:
> Employee e = new Employee();e.setEmployeeId(2);Employee eCopy =
> session.readObject(e);System.out.print(eCopy.getEmployeeId());
> I think the result should be "2" but the result I get is "1".
> Is it designed to be that?
> Regards,Bozhou
>  		 	   		 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/question-about-readObject%28Object-object%29-method-in-Session-class-tp29272382p29336586.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top