|
[
Permalink
| « Hide
]
Michael Kopp added a comment - 15/Mar/05 04:38 AM
SQL
In my opinion, and according to the documentation, the collection startNodes should only return the subclass StartNode. The Select returns all and thus the lazy loading produces an exception:
2005-03-15 11:23:14,548 [main] DEBUG - initializing collection [com.ftisoft.workflow.definition.Workflow.startNodes#B-0aDCFC2euJC000] 2005-03-15 11:23:14,548 [main] DEBUG - checking second-level cache 2005-03-15 11:23:14,564 [main] DEBUG - collection not cached 2005-03-15 11:23:14,564 [main] DEBUG - batch loading collection: [com.ftisoft.workflow.definition.Workflow.startNodes#B-0aDCFC2euJC000] 2005-03-15 11:23:14,564 [main] DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 2005-03-15 11:23:14,579 [main] DEBUG - select startnodes0_.workflow_id as workflow6___, startnodes0_.id as id__, startnodes0_.id as id0_, startnodes0_.name as name0_0_, startnodes0_.description as descript4_0_0_, startnodes0_.classname as classname0_0_, startnodes0_.workflow_id as workflow6_0_0_ from FT_O_WFND startnodes0_ where startnodes0_.workflow_id=? 2005-03-15 11:23:14,595 [main] DEBUG - preparing statement 2005-03-15 11:23:14,595 [main] DEBUG - binding 'B-0aDCFC2euJC000' to parameter: 1 2005-03-15 11:23:14,782 [main] DEBUG - about to open ResultSet (open ResultSets: 0, globally: 0) 2005-03-15 11:23:14,782 [main] DEBUG - result set contains (possibly empty) collection: [com.ftisoft.workflow.definition.Workflow.startNodes#B-0aDCFC2euJC000] 2005-03-15 11:23:14,782 [main] DEBUG - uninitialized collection: initializing 2005-03-15 11:23:14,798 [main] DEBUG - processing result set 2005-03-15 11:23:14,798 [main] DEBUG - result set row: 0 2005-03-15 11:23:14,798 [main] DEBUG - returning 'PF0aDCFS2euJC000' as column: id0_ 2005-03-15 11:23:14,798 [main] DEBUG - result row: EntityKey[com.ftisoft.workflow.definition.StartNode#PF0aDCFS2euJC000] 2005-03-15 11:23:14,814 [main] DEBUG - about to close ResultSet (open ResultSets: 1, globally: 1) 2005-03-15 11:23:14,829 [main] DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1) 2005-03-15 11:23:14,829 [main] DEBUG - closing statement 2005-03-15 11:23:14,845 [main] ERROR - cannot access loading collection org.hibernate.LazyInitializationException: cannot access loading collection at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:167) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:47) at org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:117) I think the select should filter for type='START' right?
<discriminator force="true"/>
Do not submit user questions to JIRA. This is for bugs in Hibernate. Use the user forum. 1. I did search quite a time through the forums. I found several people having the same problem, but non got an answer from the hibernate team.
I checked the documentation about polymorphism limits (9.2) and according to that, my need is straight forward and supported (table-per-class, one-to-many) 2. The thing you are describing is not what I want. at least not according to documentation. force (optional - defaults to false) "force" Hibernate to specify allowed discriminator values even when retrieving all instances of the root class Which is not what I do. Please check again my sample (workflow). I do NOT retrieve the Root class (Node) but a subclass (StartNode,EndNode) in the 2 one-to-many associations. Thus the force option should have nothing to do with it! Not until now, I will. But if it works, the documentation is wrong.
And do you understand, that in this sample, I should not need any extra configuration? The one-to-many referes to the SubClass. It should therefore not retrieve the root class. Ok you are right it works. But why do I need it in the first place? As I said I already specified that I want only the sub-class by using it in the one-to-many relation.
|
||||||||||||||||||||||||||||||||||||||||||||||||