[jboss-user] [JBoss Seam] - Read only transactions or entityManagers
Kruno
do-not-reply at jboss.com
Sat Jun 23 05:53:02 EDT 2007
I am using seam 1.2.1 EJB 3.0 in JBOSS 4.0.5
Application that I am making has a need that every change is historically saved. It is a bit of a pickle, but I have managed to make a system, actually every entity has its historical counter part through which every change on original entity is saved so you can later browse entities throw time. To achieve that functionality I use @postload method in which I load historical version of entity and copy its attributes on real one so that user can see what some entity looked like in past on certain date.
That all works fine but now comes the problem because I have changed original attributes the entity is now dirty, and it is automatically committed to database. I can not allow that when conversation is working in past time there can not be any changes to entities.
I would like to use seam managed persistence because it is a complicated application and many statefull beans work together in one conversation. But here comes the problem of transactions that I can not actually control them.
I allso tried with query.hint(readOnly) but that does not work for entities who are eagerly and lazy fetched.
I was wondering is there a way to configure entity manager to mark entities as read-only so they would never be persisted, if that is possible then I would use 2 managers on for normal behavior and one for looking at entities in the past.
Please any ideas on this problem even if they mean some what changing my ideas on how to persist historical data
Thanks in advance Kruno.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057111#4057111
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057111
More information about the jboss-user
mailing list