-->
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.  [ 4 posts ] 
Author Message
 Post subject: Deny nontransactional write
PostPosted: Wed Jun 15, 2016 8:47 am 
Newbie

Joined: Wed Jun 15, 2016 8:42 am
Posts: 2
Hello,
we're evaluating a migration from DataNucleus to Hibernate.

We're using bytecode enhancement and deny use of setters on persistent objects whilst outside of an transaction. In DataNucleus this is performed by setting the property "datanucleus.NontransactionalWrite" to false in the persistence.xml. In case of using a setter outside a transaction an exception is thrown.

However, I did not find any similar in Hibernate, is this behaviour possible?

Best Regards


Top
 Profile  
 
 Post subject: Re: Deny nontransactional write
PostPosted: Thu Jun 16, 2016 10:52 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
In Hibernate, there is no such equivalent. However, you can't execute any modifications outside a transaction. This is prohibited by JPA. Therefore, you should be fine.


Top
 Profile  
 
 Post subject: Re: Deny nontransactional write
PostPosted: Fri Jun 17, 2016 1:20 am 
Newbie

Joined: Wed Jun 15, 2016 8:42 am
Posts: 2
Well, I'm aware that the modification to the object is not written to the datastore whilst outside a transaction, but the object can be modified and on next call to save() all changes - even these made outside the transactions - are written to the datastore.


Top
 Profile  
 
 Post subject: Re: Deny nontransactional write
PostPosted: Fri Jun 17, 2016 2:45 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I suppose you mean saveOrUpdate() or merge(). Calling save() on a detached entity is the same like calling persist() on a non-transient entity, it just results in an exception being thrown.

There is no such feature, but you can add an improvement issue to our Jira.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.