[Hibernate-JIRA] Created: (HHH-2540) Hibernate issues inserts that cause constraint violations when using session.replicate
by Scott Clasen (JIRA)
Hibernate issues inserts that cause constraint violations when using session.replicate
--------------------------------------------------------------------------------------
Key: HHH-2540
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2540
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.ga
Environment: Hibernate 3.2.0, JBPM 3.1.4, Oracle 10.2.0.2.1
Reporter: Scott Clasen
When using session.replicate to replicate a JBPM ProcessDefinition from one data store to another, hibernate does not do "the right thing" when it creates insert statements to insert the process definition into the destination data store.
There are two nullable columns with foreign keys, FK_PROCDEF_STRTSTA and FK_NODE_PROCDEF that mean ProcessDefinition must have a StartState, and a StartState must have a ProcessDefinition
here are the relevant mapping snippets.
<hibernate-mapping default-access="field">
<class name="org.jbpm.graph.def.ProcessDefinition"
table="JBPM_PROCESSDEFINITION">
<!--other mappings omitted-->
<many-to-one name="startState"
column="STARTSTATE_"
foreign-key="FK_PROCDEF_STRTSTA" />
<!--other mappings omitted-->
</class>
</hibernate-mapping>
<hibernate-mapping default-access="field">
<class name="org.jbpm.graph.def.Node"
table="JBPM_NODE"
discriminator-value="N">
<!--other mappings omitted-->
<many-to-one name="processDefinition"
column="PROCESSDEFINITION_"
foreign-key="FK_NODE_PROCDEF"/>
<!--other mappings omitted-->
</class>
</hibernate-mapping>
In the usual case of saving a ProcessDefinition, hibernate does the correct thing and inserts null for each of these foreign key columns, and then later updates these columns...like so
2007-04-02 14:22:07,863 DEBUG org.hibernate.SQL - /* insert org.jbpm.graph.def.ProcessDefinition */ insert into JBPM_PROCESSDEFINITION (NAME_, VERSION_, ISTERMINATIONIMPLICIT_, STARTSTATE_, ID_) values (?, ?, ?, ?, ?)
2007-04-02 14:22:07,863 DEBUG hibernate.type.StringType - binding 'simpleServiceDefinitionTest' to parameter: 1
2007-04-02 14:22:07,863 DEBUG hibernate.type.IntegerType - binding '3' to parameter: 2
2007-04-02 14:22:07,863 DEBUG hibernate.type.BooleanType - binding 'false' to parameter: 3
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding null to parameter: 4
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding '5290' to parameter: 5
2007-04-02 14:22:07,879 DEBUG org.hibernate.SQL - /* insert org.jbpm.graph.node.StartState */ insert into JBPM_NODE (NAME_, PROCESSDEFINITION_, ISASYNC_, ACTION_, SUPERSTATE_, CLASS_, ID_) values (?, ?, ?, ?, ?, 'R', ?)
2007-04-02 14:22:07,879 DEBUG hibernate.type.StringType - binding 'start' to parameter: 1
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding '5290' to parameter: 2
2007-04-02 14:22:07,879 DEBUG hibernate.type.BooleanType - binding 'false' to parameter: 3
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding null to parameter: 4
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding null to parameter: 5
2007-04-02 14:22:07,879 DEBUG hibernate.type.LongType - binding '5291' to parameter: 6
more inserts follow and then later in the same transaction...sets the foreign key for start state.
2007-04-02 14:22:07,973 DEBUG org.hibernate.SQL - /* update org.jbpm.graph.def.ProcessDefinition */ update JBPM_PROCESSDEFINITION set NAME_=?, VERSION_=?, ISTERMINATIONIMPLICIT_=?, STARTSTATE_=? where ID_=?
2007-04-02 14:22:07,973 DEBUG hibernate.type.StringType - binding 'simpleServiceDefinitionTest' to parameter: 1
2007-04-02 14:22:07,973 DEBUG hibernate.type.IntegerType - binding '3' to parameter: 2
2007-04-02 14:22:07,973 DEBUG hibernate.type.BooleanType - binding 'false' to parameter: 3
2007-04-02 14:22:07,973 DEBUG hibernate.type.LongType - binding '5291' to parameter: 4
2007-04-02 14:22:07,973 DEBUG hibernate.type.LongType - binding '5290' to parameter: 5
When using session.replicate to copy a fully initialized object from a source to a destination data store...hibernate does not set the start state to null and then later update...it just tries to do the insert and gets a constraint violation
2007-04-02 14:27:44,817 DEBUG org.hibernate.SQL - /* insert org.jbpm.graph.def.ProcessDefinition */ insert into JBPM_PROCESSDEFINITION (NAME_, VERSION_, ISTERMINATIONIMPLICIT_, STARTSTATE_, ID_) values (?, ?, ?, ?, ?)
2007-04-02 14:27:44,817 DEBUG hibernate.type.StringType - binding 'simpleServiceDefinitionTest' to parameter: 1
2007-04-02 14:27:44,817 DEBUG hibernate.type.IntegerType - binding '70' to parameter: 2
2007-04-02 14:27:44,817 DEBUG hibernate.type.BooleanType - binding 'false' to parameter: 3
2007-04-02 14:27:44,817 DEBUG hibernate.type.LongType - binding '5553' to parameter: 4 //This should be null, and then later updated
2007-04-02 14:27:44,817 DEBUG hibernate.type.LongType - binding '5552' to parameter: 5
2007-04-02 14:27:44,832 WARN hibernate.util.JDBCExceptionReporter - SQL Error: 2291, SQLState: 23000
2007-04-02 14:27:44,832 ERROR hibernate.util.JDBCExceptionReporter - ORA-02291: integrity constraint (JBPM.FK_PROCDEF_STRTSTA) violated - parent key not found
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 9 months
[Hibernate-JIRA] Created: (HHH-2539) QueryExcepation: Caused By is Missing
by Harald Brabenetz (JIRA)
QueryExcepation: Caused By is Missing
-------------------------------------
Key: HHH-2539
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2539
Project: Hibernate3
Issue Type: Improvement
Reporter: Harald Brabenetz
Priority: Minor
I got the following Exception and i don't know where it comes from and I don't know how I can reproduce it:
Caused by:
org.hibernate.QueryException: collection role not found: ..............
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireQueryableCollection(SessionFactoryHelper.java:205)
at org.hibernate.hql.ast.tree.DotNode.dereferenceCollection(DotNode.java:242)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:206)
at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:143)
at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:460)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4326)
Can you extend the catch - Clause with the original Exception?
From:
catch ( Exception e ) {
throw new QueryException( "collection not found: " + role );
}
Into:
catch ( Exception e ) {
throw new QueryException( "collection not found: " + role, e );
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 9 months
[Hibernate-JIRA] Updated: (HHH-1829) Allow join on any property using property-ref
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Steve Ebersole updated HHH-1829:
--------------------------------
Fix Version/s: (was: 3.2.3)
3.2.4
prep 3.2.3
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate3
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Steve Ebersole
> Fix For: 3.2.4
>
> Attachments: AbstractJoinTest.java, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 9 months
[Hibernate-JIRA] Created: (HHH-2535) Change Cache' Cache71Dialect so that sequence support returns false
by Jay Howell (JIRA)
Change Cache' Cache71Dialect so that sequence support returns false
-------------------------------------------------------------------
Key: HHH-2535
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2535
Project: Hibernate3
Issue Type: Improvement
Components: core
Reporter: Jay Howell
We don't want the naive Cache' user to have to load our sequence support XML. This is okay for advanced users but we want Hibernate to work out of the box for the naive user.
This requires changing Cache71Dialect so that
public boolean supportsSequences() {
return false;
}
This problem was uncovered at a Java conference where there were many questions about getting Cache' to work with Hibernate. The developer at that conference discovered that the Hibernate tool SchemaUpdate required the developer to load our sequence support XML into a namespace to use SchemaUpdate at all. In other words, SchemaUpdate insists on sequence support if
public boolean supportsSequences() {
return true;
}
Since we don't want naive Cache' users to run into this problem, it should be changed to
public boolean supportsSequences() {
return false;
}
The sophisticated Hibernate and Cache' user can do the following:
public class CacheSeqDialect extends Cache71Dialect {
public boolean supportsSequences() {
return true;
}
}
They can follow our instructions for enabling sequence support and then use a CacheSeqDialect as above that they define to enable sequence support.
It is better that the advanced user be a little bit inconvenienced then the naive user have trouble working with Hibernate and Cache'. This is the reason we would like the above change made to the Cache71Dialect.
Jonathan Levinson (developer of Cache71Dialect)
Senior Software Developer
Object Group
InterSystems
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 9 months