Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.1-RC2
-
Fix Version/s: None
-
Component/s: Persistence
-
Environment:Windows 7 64-bit, Java_1.0.
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Grails version: 2.1.0.RC2
Postgres 9.1.4
postgresql-9.1-902.jdbc4.jar
Description
This is most probably an hibernate issue but since I am unable to provide an example for hibernate directly, I'll post an example here and hope somebody will file a ("more qualified than I could do it") bug report there.
It may be related to this hibernate bug (at least the title suggests this) but I am not sure: https://hibernate.onjira.com/browse/HHH-3762
So if we have
class Aa {
String p1;
static constraints = {
p1(nullable:true)
}
static hasMany = [bbs : Bb];
static mapping = {}
}
class Bb {
String p2;
static constraints = {
p2(nullable:true)
}
}
This query
def aas = Aa.createCriteria().list{
bbs(org.hibernate.criterion.CriteriaSpecification.LEFT_JOIN){}
lock true
}
will generate a
Hibernate: select this_.id as id0_1_, this_.version as version0_1_, this_.p1 as p3_0_1_, bbs3_.aa_bbs_id as aa1_0_3_, bbs_alias1x1_.id as bb2_3_, bbs_alias1x1_.id as id2_0_, bbs_alias1x1_.version as version2_0_, bbs_alias1x1_.p2 as p3_2_0_ from aa this_ left outer join aa_bb bbs3_ on this_.id=bbs3_.aa_bbs_id left outer join bb bbs_alias1x1_ on bbs3_.bb_id=bbs_alias1x1_.id for update | Error 2012-06-09 16:16:09,028 [pool-5-thread-1] ERROR util.JDBCExceptionReporter - ERROR: SELECT FOR UPDATE/SHARE Hibernate: select this_.id as id0_1_, this_.version as version0_1_, this_.p1 as p3_0_1_, bbs3_.aa_bbs_id as aa1_0_3_, bbs_alias1x1_.id as bb2_3_, bbs_alias1x1_.id as id2_0_, bbs_alias1x1_.version as version2_0_, bbs_alias1x1_.p2 as p3_2_0_ from aa this_ left outer join aa_bb bbs3_ on this_.id=bbs3_.aa_bbs_id left outer join bb bbs_alias1x1_ on bbs3_.bb_id=bbs_alias1x1_.id for update | Error 2012-06-09 16:16:09,028 [pool-5-thread-1] ERROR util.JDBCExceptionReporter - FEHLER: SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join | Error 2012-06-09 16:16:09,041 [pool-5-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: could not execute query Message: could not execute query | Error 2012-06-09 16:16:09,041 [pool-5-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: could not execute query Message: could not execute query
The issue is that the generated query does not specify the table to lock (it should read "...for update of this_").
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits