[Hibernate-JIRA] Commented: (ANN-401) @OrderBy does not work with inherited properties
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-401?page=co... ]
Emmanuel Bernard commented on ANN-401:
--------------------------------------
try to implement a patch and you will see.
> @OrderBy does not work with inherited properties
> ------------------------------------------------
>
> Key: ANN-401
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-401
> Project: Hibernate Annotations
> Issue Type: Bug
> Components: binder
> Affects Versions: 3.2.0.cr1
> Environment: Hibernate 3.2, MySql 4, Windows XP
> Reporter: Guido Laures
>
> Using an @OrderBy with an inherited property produces an SQL Exception.
> Example:
> @Entity
> class Base {
> ...
> public int getPropertyForOrderBy(){ return propertytoOrderBy; }
> ...
> }
> @Entity
> @PrimaryKeyJoinColumn(name="a_id")
> class A extends Base {
> ...
> }
> @Entity
> @PrimaryKeyJoinColumn(name="b_id")
> class B extends Base {
> ...
> @OneToMany(mappedBy = "someProp", cascade = { CascadeType.ALL })
> @OrderBy("propertyToOrderBy")
> public Set<A> getASet() {
> return this.aSet;
> }
> ...
> }
> Thus, if A references a set of Bs and wants it to be ordered by a property of B's base class Base it crashes. The generated SQL string tries to find the property from the base class in the table of the inerited class (A) which fails.
--
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, 10 months
[Hibernate-JIRA] Commented: (HHH-476) Event System documentation
by Anirudh Vyas (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-476?page=co... ]
Anirudh Vyas commented on HHH-476:
----------------------------------
Steve,
Hibernate Event System lacks documentation as well as some of the parts ( or i think so, correct me if i go wrong somewhere ).
In the Event System ( for example OnSaveOrUpdateEvent )
It would be appropriate to move all the Event delegation based code to an Event Delegate which has all the listeners registered to it and then use a Broadcast agent to do broadcast ( or Fire an event in Hibernate Terminology ) the events and loop through listeners to check.
something like :
// fire the event
SessionImpl.broadcastSaveEvent( SaveEvent( Phase.SAVE, Source etc etc ) , BaseEventDelegate );
// use a BroadCast interface and implement a DefaultBroadcastAgent and do something like
DefaultBroadcastAgent.processBroadcast( BaseEventDelegate )
// broadcaster above uses event delegate passed to it to loop through listeners.
// same as in SessionImpl.
we could also check if listeners passed to this was an appropriate listener or not.
Let me know in case you need more clarifications.
Regards
Vyas, Anirudh
> Event System documentation
> --------------------------
>
> Key: HHH-476
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-476
> Project: Hibernate3
> Issue Type: Improvement
> Components: documentation
> Affects Versions: 3.0.3
> Reporter: Alexandre Torres
>
> The new event system documentation reference guide is too small. It does not cover issues about transaction and chaining. What about a tutorial in using that?
--
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, 10 months
[Hibernate-JIRA] Commented: (HHH-1594) Add on-delete="cascade" support to unidirectional *ToOne relationships.
by Ivan Garcia (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1594?page=c... ]
Ivan Garcia commented on HHH-1594:
----------------------------------
Hi, I think this feauture it's very important. You can have unidirectional *ToOne relationships wiht on-delete and on-update policcies support. You can add another attribute like on-update, for example you can have:
<class name="Parent">
....
</class>
<class name="Child">
...
<many-to-one name="parent" on-delete="cascade" on-update="cascade"/>
</class>
The cascade possible values can be:
No Action
Cascade
Set Null
Restrict
With the current version of HB we must to have a .sql script to modify this relationships on delete and on update policies.
> Add on-delete="cascade" support to unidirectional *ToOne relationships.
> -----------------------------------------------------------------------
>
> Key: HHH-1594
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1594
> Project: Hibernate3
> Issue Type: Improvement
> Components: core
> Environment: Hibernate 3.1.x, any dialect with cascading deletes.
> Reporter: Steve Bazyl
>
> Currently the on-delete="cascade" option is only available on bi-directional/inverse collections. However, there are some instances where we don't want the collections on the parent side of the relationship, creating a unidirection relationship from child to parent. It would be nice to be able to do something like:
> <class name="Parent">
> ....
> </class>
> <class name="Child">
> ...
> <many-to-one name="parent" on-delete="cascade"/>
> </class>
> So that child entries are deleted when the parent goes away. Obviously in this particular example it would be OK to add the collection, but in the actual situation we'd like this in the collection would serve no practical purpose.
> It's not critical by any means -- we can just tewak the schema by hand and that's fine. But it seems like an easy enough thing to add and would make the schema generation/update tools a little more robust.
--
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, 10 months
[Hibernate-JIRA] Created: (HBX-1039) many-to-many associations not working with hibernate
by Vijaya Krishnan (JIRA)
many-to-many associations not working with hibernate
----------------------------------------------------
Key: HBX-1039
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1039
Project: Hibernate Tools
Issue Type: Bug
Environment: Hibernate Tools 3.2 beta 10, Oracle 10G,
Reporter: Vijaya Krishnan
Associated tables in a Many-To-Many relationship not updating with Hibernate. No HQL is generated to insert values into the link table. Using Hibernate Tools 3.2 beta 10
Here are the hbm and java snippets.
-------------------------------------------------------------------------------------
Person.hbm.xml
<!-- bi-directional many-to-many association to Staff -->
<set name="staffs" table="PERSON_STAFF" lazy="false" inverse="true" cascade="save-update">
<key>
<column name="PERSON_OID" precision="22" scale="0" not-null="true" />
</key>
<many-to-many class="domain.Staff" column="STAFF_OID" fetch="join" />
</set>
</class>
-----------------------------
Staff.hbm.xml
<!-- bi-directional many-to-many association to Person -->
<set name="persons" table="PERSON_STAFF" cascade="all">
<key>
<column name="STAFF_OID" precision="22" scale="0" not-null="true" />
</key>
<many-to-many column="PERSON_OID" class="domain.Person" />
</set>
--------------------------------------------------------------------
person.java
public class Person implements java.io.Serializable {
private long oid;
private String userid;
private String firstname;
private String lastname;
private Set staffs = new HashSet();
//other getters and setters here.
public Set getStaffs() {
return this.staffs;
}
public void setStaffs(Set staffs) {
this.staffs = staffs;
}
------------------------------------------------------
staff.java
public class Staff implements java.io.Serializable {
private long oid;
private String staffname;
private long headcount;
private Set persons = new HashSet(0);
//other getters and setters here.
public Set getPersons() {
return persons;
}
public void setPersons(Set persons) {
this.persons = persons;
}
}
------------------------------------------------------------------------
Link table columns:
CREATE TABLE PERSON_STAFF( PERSON_OID NUMBER NOT NULL, STAFF_OID NUMBER NOT NULL)
PERSON table has primary key oid and STAFF table has primary key oid as well. The link table is made of only the columns - person-oid and staff_oid. The CONSTRAINTs of priamry and foreign key relationships are all set in the database.
-------------------------------------------------------------------
The lines of code to update the tables:
person.getStaffs().add(newStaff); //Line 1
update(person); //Line 2
-------------------------------------------
A person is associated with multiple staffs e.g. five staffs. The line 2 update generates five updates to the staff table instead of one insert in the link table.
The above does not update the link table PERSON_STAFF, but updates the person and staff table.
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Tim McCune (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Tim McCune commented on HHH-1830:
---------------------------------
The test case does, but I'd be surprised if annotations had anything to do with the bug. I just haven't used Hibernate without annotations is so long that it would be painful to try to re-learn the XML syntax. :) Is that a problem?
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
> Attachments: hibernateBug.tar.gz
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Max Rydahl Andersen commented on HHH-1830:
------------------------------------------
so it requires annotations ?
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
> Attachments: hibernateBug.tar.gz
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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, 11 months
[Hibernate-JIRA] Updated: (HHH-1830) Error during parse query on MS SQL
by Tim McCune (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Tim McCune updated HHH-1830:
----------------------------
Attachment: hibernateBug.tar.gz
Test case attached. Run "mvn test".
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
> Attachments: hibernateBug.tar.gz
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2957) ActionQueue Insertion sort performance degrades exponentially
by Jay Erb (JIRA)
ActionQueue Insertion sort performance degrades exponentially
-------------------------------------------------------------
Key: HHH-2957
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2957
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Reporter: Jay Erb
Attachments: ActionQueue.java, NewInsertActionSorter.java
The algorithm for sorting entity insertions performs poorly for when flushing large numbers of entity insertions.
There are a few reasons for this:
1. The sort used linear searches over lists which required nested looping.
2. ArrayLists were used to hold the insertion events. ArrayLists give good performance for looping but they have a couple of significant drawbacks:
a. Whenever a new item is added to the list, the list is rebuilt with the new size, which causes another loop over all the entries in the list.
b. Since it is an array, a contiguous block of memory must be found to hold the array. As the array get large, it gets harder and harder to find a contiguous block large enough. This causes the garbage collector to be run more often, which obviously reduces performance again.
I changed the algorithm so that the product of the sort is exactly the same. The difference is that I used hashes for searches and LinkedLists for storing the insertions. The performance is linear.
Attached are my changes.
--
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, 11 months