[Hibernate-JIRA] Commented: (HHH-1) Optimize Hibernate for the bulk insertion of related entities
by Martin Ross (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1?page=comm... ]
Martin Ross commented on HHH-1:
-------------------------------
There are a few points highlighted in this case:
1) compareTo() contract requires transitivity to be satisfied. Assume a<b<c then a.compareTo(b) == a.compareTo(c). For complex object graphs we cannot do this unless we traverse the object graph. The proposed implementation does not do this.
2) This traversal of the object graph must be done from both directions: this -> other and other -> this . The proposed implementation does not do this.
3) Inverse relationships add another wrinkle. A can have association to B, but A should actually be inserted before B.
It seems that any implementation (unless someone smarter than me can comment on this) will require an algorithm similar to this:
-Determine if there is a path from A to B OR if there is a path from B to A
- If so then examine path to determine if A should be inserted before B or B should be inserted before A
The good news is that my current implementation (that does not satisfy transitive property) in the cases that it does not work makes a large difference in performance. Another point is that the I think the worse case performance of the entire merge sort will be very roughly n log n*m^2 where n is number of items in the action queue and m is the number of classes in the object graph. Both m and n will typically very small so it shouldn't be a huge deal. Presumably caching the results of compareTo() between any two class can chop another order of magnitude off the performance.
Anyways, my thoughts.. Please feel free to prove me wrong, etc.. Also if someone who knows the hibernate code well can suggest an easy way to derive the path between two objects I would love to hear from them :)
> Optimize Hibernate for the bulk insertion of related entities
> -------------------------------------------------------------
>
> Key: HHH-1
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1
> Project: Hibernate3
> Type: New Feature
> Components: core
> Environment: Hibernate 1.2, MySql 3.1
> Reporter: Bradley Leupen
> Priority: Minor
>
>
> It is currently difficult to batch the creation of persistent entities that maintain associations with other entities.
> Add necessary api to hibernate to support the save or update of a collection of entities. An optimization can be applied in this scenario to group inserts / updates by entity class, or table. This will enable the hibernate engine to utilize batching if available, drastically improving performance over a network.
--
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
19 years, 1 month
[Hibernate-JIRA] Created: (ANN-496) NPE when NamedQuery contains space before variable name
by Rüdiger Schulz (JIRA)
NPE when NamedQuery contains space before variable name
-------------------------------------------------------
Key: ANN-496
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-496
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.ga
Environment: JDK 1.5.0_09-b03, JBoss 4.0.5 GA, MySQL 5.0.24a, mysql-connector-java-5.0.4
Reporter: Rüdiger Schulz
Priority: Minor
I just got a weird NullPointerException using Hibernate JPA. When creating my EntityManagerFactory, the usual logging started to appear and finished in stacktrace containing this:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.hql.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:63)
at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:296)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:97)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:400)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:351)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
I could root it down to a NamedQuery in one of my Entites; when commenting it out, the creation went through fine. The Query definition looked like this:
@NamedQuery(
name = "User.find",
query = "SELECT user FROM User user WHERE user.id =: id"
)
After some googling I found a solution on the Spring forum: it's the whitespace between the colon and the variable name. The error message should be more specific here, or better yet, the whitespace should not throw an error.
--
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
19 years, 1 month
[Hibernate-JIRA] Moved: (HHH-2264) NPE when NamedQuery contains space before variable name
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2264?page=all ]
Emmanuel Bernard moved ANN-496 to HHH-2264:
-------------------------------------------
Project: Hibernate3 (was: Hibernate Annotations)
Key: HHH-2264 (was: ANN-496)
Version: 3.2.1
(was: 3.2.0.ga)
> NPE when NamedQuery contains space before variable name
> -------------------------------------------------------
>
> Key: HHH-2264
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2264
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.2.1
> Environment: JDK 1.5.0_09-b03, JBoss 4.0.5 GA, MySQL 5.0.24a, mysql-connector-java-5.0.4
> Reporter: Rüdiger Schulz
> Priority: Minor
>
>
> I just got a weird NullPointerException using Hibernate JPA. When creating my EntityManagerFactory, the usual logging started to appear and finished in stacktrace containing this:
> Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.hql.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:63)
> at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:296)
> at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:97)
> at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
> at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:400)
> at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:351)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
> at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
> I could root it down to a NamedQuery in one of my Entites; when commenting it out, the creation went through fine. The Query definition looked like this:
> @NamedQuery(
> name = "User.find",
> query = "SELECT user FROM User user WHERE user.id =: id"
> )
> After some googling I found a solution on the Spring forum: it's the whitespace between the colon and the variable name. The error message should be more specific here, or better yet, the whitespace should not throw an error.
--
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
19 years, 1 month