This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes how to refresh ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how to refresh ..." Watch "how to refresh ..." New topic
Author

how to refresh ...

mihran eprem
Greenhorn

Joined: Apr 26, 2012
Posts: 4
hi
my problem is that i have a big database schema that is should map my entities on it
the schema contain tables and database views (the database design i cant change )
i mapped one entity in one of the database views its worked fine (of course its not updateable )
then i map another entity to a database table that related on previous database view (its updateable)
when i update the entity and merge it
the first entity still contain the old values

i cant use manual em.refresh() , because the is a lot of records (more than 25000)

any solution any idea

tnx

i tried to use em listeners ...don't work
i tried to put cascade merge ...don't work


Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
You need to execute another call to get the view data.

Also, if caching is involved, in case the update connection and view connection uses different connections (or hibernate setups), the view call to get data should not be cached (this can be an issue you need to resolve especially if huge data is involved). If they are together (the view and update calls) in the same hibernate setup, and the view is cached, the update must refresh/clear the cache when update is called.
mihran eprem
Greenhorn

Joined: Apr 26, 2012
Posts: 4
thank you for for your information
but there is some point that is should clarified
1-im using ejb 3
2- deploy on weblogic
3 my data base is oracle 11g
4 yes all the entities use the same database connection

can i disable the cash for on entity ???
Leslie White
Greenhorn

Joined: Apr 28, 2012
Posts: 2
Hi!

In persistence.xml try this: <shared-cache-mode>NONE</shared-cache-mode> or can be selectively enabled/disabled using the @Cache annotation on entity.


flaccy
mihran eprem
Greenhorn

Joined: Apr 26, 2012
Posts: 4
thank you
i try it and its worked so good
thank you again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to refresh ...
 
Similar Threads
connection pool: difference between tables and views?
CMP Entity Beans Vs BMP Entity Beans
Updatable resultsets
EJB 3 IN ACTION - EntityManager merge() and refresh() method conflict
Hibernate and database view