We have just released Hibernate Search 4.1 CR2. This is mostly a bug fix release but let's mention better compatibility with JBoss AS 7 and better write throughput.
Read more at http://goo.gl/2OV8w
The first early draft of Bean Validation 1.1 is out. Go for it http://goo.gl/FlAuQ
for people unfamiliar, Bean Validation is the JCP standard implemented by Hibernate Validator. You can read more about it at http://beanvalidation.org
Indexed collections (maps and lists) should always be the owning side
of bi-directional associations for the exact reason you mention. Not
sure if annotations actually enforces that or whether JPA even allows
us to enforce that.
On Fri 09 Mar 2012 07:53:20 AM CST, Demetz, Guenther wrote:
> Thank you Steve,
> anyway in this context
> I strongly recommend all Hibernate-Users to force version increment explicitly on such OneToMany relations when the mapped collection is a map!
> Otherwise, unless implementing some pessimistick locking, 2 concurrent transactions will be able to insert an object in the map, each indipendently from the other, using the same key value, without getting any exception at flush or commit time.
> This leads finally in having 2 records persisted on database whilst in hibernate (due the constraints of the map) on successive accesses you always will see just one. This is quite dangereous.
The old behavior violated JPA spec. The issue is HHH-7138
On Fri 09 Mar 2012 03:04:54 AM CST, Demetz, Guenther wrote:
> Hi hibernate developers,
> testing Hibernate ORM 4.1.1 I discovered a behavior change regarding Optimistic Lock Versioning
> in detail on bidirectional OneToMany relations with inverse-owner (mappedBy attribute specified):
> - until Hiberante version 4.1.0 by default on changes both involved sides got a version increment
> - now with Hiberante4.1.1 only the owner-side (=the Many-side) gets a version increment.
> To make the thing working as before,
> now on such relations we must define explicitly OptimisticLock.excluded=false
> @javax.persistence.OneToMany(mappedBy = "parent")
> private Map<String,Child> aggChild = new java.util.HashMap();
> Was such behavior change intended?
> I looked at the 28 issues which had been fixed with Hiberante4.1.1 but found nothing in regard,
> maybe I overlooked something ?
> Würth Phoenix S.r.l.
> Günther Demetz
> Via Kravogl 4
> I-39100 Bolzano
> E-Mail: guenther.demetz(a)wuerth-phoenix.com
> Website: www.wuerth-phoenix.com