-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: what is the purpose of refresh() in EntityManager
PostPosted: Sun Feb 20, 2011 10:07 am 
Newbie

Joined: Thu Feb 21, 2008 12:15 pm
Posts: 4
I am trying out a simple test case, But I get an exception java.lang.IllegalArgumentException: Entity not managed. Can somebody give me a test case to test how the refresh() of entitymanager works

//get username
User user = ObjectManager.findById(2L);
//make dirty
user.setUsername("xyz");
//undo dirty changes
ObjectManager.refresh(user);
assertEquals(eventLog.getUsername(), "john");


Also for the contains() method of the entityManager. It always returns false. I have tried getReference() and then check using contains() but again false.


Top
 Profile  
 
 Post subject: Re: what is the purpose of refresh() in EntityManager
PostPosted: Mon Feb 21, 2011 6:07 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Apparently your ObjectManager object is'nt a instance of entitymanager.
So can you please tell something more about your implementation of ObjectManager,
especially how the methods .findById() and .refresh() are implemented ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.