[Hibernate-JIRA] Créée: (HHH-2061) Record User parameters directly int the Hibernate session
by Xavier Brénuchon (JIRA)
Record User parameters directly int the Hibernate session
---------------------------------------------------------
Key: HHH-2061
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2061
Project: Hibernate3
Type: Improvement
Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4
Reporter: Xavier Brénuchon
Hello,
I need to transmit some informations about runtime context of my application to my IdentifierGenerator.
Today, the only solution is to use a fake filter as :
mySession.enableFilter("myFakeFilter").setParameter("myParam", myvalue);
And in my IdentifierGenerator:
// Filter interface has not getParameter methode, so I cast to FilterImpl.
((FilterImpl)mySession.getEnabledFilter("myFakeFilter")).getParameter("myParam");
Is it possible that we can record User parameters directly int the Hibernate session?
(In fact, the equivalent of PersistanceManager of JDO) :
Object putUserObject(Object key, Object value);
Object removeUserObject(Object key);
Object getUserObject(Object key);
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-944) In one-to-many relationship (Set, Map, List), let <key> accept <formula> as an alternative to <column>.
by Xavier Brénuchon (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-944?page=co... ]
Xavier Brénuchon commented on HHH-944:
--------------------------------------
Hello,
I am also very interested by this functionality.
We develop an application which has very strong need for performance with several tens of million recordings. Partitioning is a need.
Because all my tables have a column of partitioning, I need to use shared composite key attribute for all my relations.
So for a <many-to-many>, I use the example of the doc (23.4.3 :)
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<set name="groups" table="UserGroup">
<key>
<column name="userName"/>
<column name="org"/>
</key>
<many-to-many class="Group">
<column name="groupName"/>
<formula>org</formula>
</many-to-many>
</set>
</class>
For a <many-to-one> I use :
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<many-to-one name="team">
<formula>org</formula>
<column name="FK_TEAM"/>
</many-to-one>
</class>
The only problem is for <one-to-many> because <formula> is not possible in <key> :
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<set name="contrats" cascade="all, delete-orphan">
<key>
<!-- formula is not authorized :( -->
<formula>org</formula>
<column name="FK_USER"/>
</key>
<one-to-many class="Contrat"/>
</set>
</class>
<class name="Contrat" table="CONTRAT">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<!-- ... -->
</class>
It is a limitation which prevents the use of a effective partitioning in data base.
I carried out a test by modifying the source code of hibernate that can function without many modifications.
Is it possible that Hibernate is enriched by this functionality?
> In one-to-many relationship (Set, Map, List), let <key> accept <formula> as an alternative to <column>.
> ---------------------------------------------------------------------------------------------------------
>
> Key: HHH-944
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-944
> Project: Hibernate3
> Type: New Feature
> Versions: 3.1 rc3
> Reporter: Etienne Laverdiere
>
>
> As explain in http://forum.hibernate.org/viewtopic.php?t=947249&highlight=&sid=c6df51fc... and alternatively in http://forum.hibernate.org/viewtopic.php?t=947145&highlight=&sid=c6df51fc..., it would be nice if the <key> inside a SET or any collection (one-to-many relationship) could accept a <formula> instead of the column:
> Example:
> <set name="childrens" lazy="true" inverse="true">
> <key foreign-key="FinancialTransit">
> <formula>ANY SQL</formula>
> </key>
> <one-to-many class="com.eg.Children" />
> </set>
> instead of :
> <set name="childrens" lazy="true" inverse="true">
> <key foreign-key="key1">
> <column name="key2" scale="10"
> precision="0" not-null="false" unique="true" />
> </key>
> <one-to-many class="com.eg.Children" />
> </set>
> It would necessitate to patch the class AbstractCollectionPersister and modify the DTD of hibernate mapping.
> Regards,
> Etienne
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-158) nested DetachedCriteria throwing NullPointerException
by Christian Bauer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-158?page=co... ]
Christian Bauer commented on HHH-158:
-------------------------------------
Of course I can expect that. This is an open source project. If none of the committers and developers has the time to move this issue up on their TODO list, somebody else will have to do it.
> nested DetachedCriteria throwing NullPointerException
> -----------------------------------------------------
>
> Key: HHH-158
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-158
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0 beta 4
> Reporter: Jérôme Boehm
> Assignee: Gavin King
> Attachments: testcase.zip
>
>
> It seems that it is not possible to nest DetachedCriteria.
> This is examplified in the testWithReturnedObject() method of the attached TestCase.
> When nesting DetachedCriteria using DetachedCriteria.add(Subqueries.<a_Subqueries_static_method>) twice, we get the following exception:
> java.lang.NullPointerException
> at org.hibernate.criterion.SubqueryExpression.getTypedValues(SubqueryExpression.java:73)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:230)
> at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:50)
> at org.hibernate.criterion.Junction.toSqlString(Junction.java:58)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:312)
> at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1208)
> at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
> at test.subqueries.SubqueriesTest.main(SubqueriesTest.java:41)
> Then, after "correcting" SubqueryExpression so that the params instance variable is initialized (see the attached Corrected_SubqueryExpression), it seems that the nested aliases are not properly propagated, which is examplified in testWithNoReturnedObject().
> The generated sql is:
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this0__.c_id as y0_ from c this0__ where this0__.b_id=this0__.b_id))
> I think it should be (notice the this1__ alias for table c):
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this1__.c_id as y0_ from c this1__ where this1__.b_id=this0__.b_id))
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-158) nested DetachedCriteria throwing NullPointerException
by Rüdiger Hain (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-158?page=co... ]
Rüdiger Hain commented on HHH-158:
----------------------------------
So is there any chance to have this patch integrated into one of the next releases ? Christian - not every Hibernate user concerned about this bug is able to provide a patch, let alone a robust fix. So 25 votes simply means there is an urgent need for this to be fixed, you cant seriously expect those voters are all Hibernate experts digging into the code to get it done.
> nested DetachedCriteria throwing NullPointerException
> -----------------------------------------------------
>
> Key: HHH-158
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-158
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0 beta 4
> Reporter: Jérôme Boehm
> Assignee: Gavin King
> Attachments: testcase.zip
>
>
> It seems that it is not possible to nest DetachedCriteria.
> This is examplified in the testWithReturnedObject() method of the attached TestCase.
> When nesting DetachedCriteria using DetachedCriteria.add(Subqueries.<a_Subqueries_static_method>) twice, we get the following exception:
> java.lang.NullPointerException
> at org.hibernate.criterion.SubqueryExpression.getTypedValues(SubqueryExpression.java:73)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:230)
> at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:50)
> at org.hibernate.criterion.Junction.toSqlString(Junction.java:58)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:312)
> at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1208)
> at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
> at test.subqueries.SubqueriesTest.main(SubqueriesTest.java:41)
> Then, after "correcting" SubqueryExpression so that the params instance variable is initialized (see the attached Corrected_SubqueryExpression), it seems that the nested aliases are not properly propagated, which is examplified in testWithNoReturnedObject().
> The generated sql is:
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this0__.c_id as y0_ from c this0__ where this0__.b_id=this0__.b_id))
> I think it should be (notice the this1__ alias for table c):
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this1__.c_id as y0_ from c this1__ where this1__.b_id=this0__.b_id))
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1305) Better exception message for version type mismatch
by Brian Viveiros (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1305?page=c... ]
Brian Viveiros commented on HHH-1305:
-------------------------------------
I'm seeing this when a JBPM timer triggers an Action. The Action creates a new hibernate session and does some database work then comits.
The following line in org.jbpm.scheduler.impl.SchedulerThread.executeTimers() results in the exception:
// save the process instance
jbpmContext.save(timer.getProcessInstance());
Is there a workaround to suppress this message? I can set logging to something higer than INFO but then I might miss out on other messages.
Thanks.
> Better exception message for version type mismatch
> --------------------------------------------------
>
> Key: HHH-1305
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1305
> Project: Hibernate3
> Type: Improvement
> Components: core
> Versions: 3.1 rc3
> Reporter: Tom Baeyens
> Priority: Minor
>
>
> Documentation says correctly that the default type of a version is integer. When you don't specify the type and use a long member field, hibernate doesn't use reflection to determine the type of the version member field and generates an exception that doesn't really relate to the problem:
> java.lang.RuntimeException: problem closing service 'org.jbpm.persistence.db.DbPersistenceService@1292d12'
> at org.jbpm.svc.Services.close(Services.java:179)
> at org.jbpm.JbpmContext.close(JbpmContext.java:116)
> at org.jbpm.db.AbstractDbTestCase.closeJbpmContext(AbstractDbTestCase.java:108)
> at org.jbpm.db.AbstractDbTestCase.tearDown(AbstractDbTestCase.java:39)
> at junit.framework.TestCase.runBare(TestCase.java:130)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.jbpm.persistence.PersistenceException: couldn't commit hibernate session
> at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:118)
> at org.jbpm.svc.Services.close(Services.java:172)
> ... 19 more
> Caused by: org.hibernate.AssertionFailure: null id in org.jbpm.graph.exe.ProcessInstance entry (don't flush the Session after an exception occurs)
> at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:48)
> at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:140)
> at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:97)
> at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
> at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:877)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:344)
> at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
> at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:116)
> ... 20 more
> The exception is thrown from DefaultFlushEventListener.checkId:
> /**
> * make sure user didn't mangle the id
> */
> public void checkId(Object object, EntityPersister persister, Serializable id, EntityMode entityMode)
> throws HibernateException {
> if ( persister.hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) {
> Serializable oid = persister.getIdentifier( object, entityMode );
> if (id==null) {
> throw new AssertionFailure("null id in " + persister.getEntityName() + " entry (don't flush the Session after an exception occurs)");
> }
> if ( !persister.getIdentifierType().isEqual(id, oid, entityMode) ) {
> throw new HibernateException(
> "identifier of an instance of " +
> persister.getEntityName() +
> " was altered from " + id +
> " to " + oid
> );
> }
> }
> }
> regards, tom.
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-158) nested DetachedCriteria throwing NullPointerException
by Christian Bauer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-158?page=co... ]
Christian Bauer commented on HHH-158:
-------------------------------------
Doesn't seem to be that important, otherwise one of the 25 voters would have submitted a patch.
> nested DetachedCriteria throwing NullPointerException
> -----------------------------------------------------
>
> Key: HHH-158
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-158
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0 beta 4
> Reporter: Jérôme Boehm
> Assignee: Gavin King
> Attachments: testcase.zip
>
>
> It seems that it is not possible to nest DetachedCriteria.
> This is examplified in the testWithReturnedObject() method of the attached TestCase.
> When nesting DetachedCriteria using DetachedCriteria.add(Subqueries.<a_Subqueries_static_method>) twice, we get the following exception:
> java.lang.NullPointerException
> at org.hibernate.criterion.SubqueryExpression.getTypedValues(SubqueryExpression.java:73)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:230)
> at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:50)
> at org.hibernate.criterion.Junction.toSqlString(Junction.java:58)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:312)
> at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1208)
> at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
> at test.subqueries.SubqueriesTest.main(SubqueriesTest.java:41)
> Then, after "correcting" SubqueryExpression so that the params instance variable is initialized (see the attached Corrected_SubqueryExpression), it seems that the nested aliases are not properly propagated, which is examplified in testWithNoReturnedObject().
> The generated sql is:
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this0__.c_id as y0_ from c this0__ where this0__.b_id=this0__.b_id))
> I think it should be (notice the this1__ alias for table c):
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this1__.c_id as y0_ from c this1__ where this1__.b_id=this0__.b_id))
--
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
16 years, 6 months
[Hibernate-JIRA] Commented: (HHH-158) nested DetachedCriteria throwing NullPointerException
by Ido Tzang (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-158?page=co... ]
Ido Tzang commented on HHH-158:
-------------------------------
is there a designated version for a fix for this issue ?
it's a huge limitation in my opinion (limits us in using Criteria API for complex queries)
> nested DetachedCriteria throwing NullPointerException
> -----------------------------------------------------
>
> Key: HHH-158
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-158
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0 beta 4
> Reporter: Jérôme Boehm
> Assignee: Gavin King
> Attachments: testcase.zip
>
>
> It seems that it is not possible to nest DetachedCriteria.
> This is examplified in the testWithReturnedObject() method of the attached TestCase.
> When nesting DetachedCriteria using DetachedCriteria.add(Subqueries.<a_Subqueries_static_method>) twice, we get the following exception:
> java.lang.NullPointerException
> at org.hibernate.criterion.SubqueryExpression.getTypedValues(SubqueryExpression.java:73)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:230)
> at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:50)
> at org.hibernate.criterion.Junction.toSqlString(Junction.java:58)
> at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:312)
> at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1208)
> at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
> at test.subqueries.SubqueriesTest.main(SubqueriesTest.java:41)
> Then, after "correcting" SubqueryExpression so that the params instance variable is initialized (see the attached Corrected_SubqueryExpression), it seems that the nested aliases are not properly propagated, which is examplified in testWithNoReturnedObject().
> The generated sql is:
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this0__.c_id as y0_ from c this0__ where this0__.b_id=this0__.b_id))
> I think it should be (notice the this1__ alias for table c):
> select this_.a_id as a1_0_ from a this_ where exists (select this0__.b_id as y0_ from b this0__ where this0__.a_id=this_.a_id and exists (select this1__.c_id as y0_ from c this1__ where this1__.b_id=this0__.b_id))
--
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
16 years, 6 months