[Hibernate-JIRA] Created: (HHH-2272) Serious performance problems when saving large amount of transient entities with collections of transient entities
by Markus Heiden (JIRA)
Serious performance problems when saving large amount of transient entities with collections of transient entities
------------------------------------------------------------------------------------------------------------------
Key: HHH-2272
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2272
Project: Hibernate3
Type: Task
Components: core
Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 on Oracle 9.2
Reporter: Markus Heiden
When saving many (e.g. 50000) transient entities with a collection of transient entities, for each collection element the whole persistence context is searched (by StatefulPersistenceContext#getIndexInOwner() and StatefulPersistenceContext#getOwnerId) and its even searched twice when the collection is an indexed collection. This leads to an enormous amount (> 1000000) of iterations over all entities and over all collection elements of each entity. Especially when one saves only the same type of entities this leads to times of hours(!) even on a fast machine before any insert statement is even issued. This issue is related to HHH-1612, but fixing issue HHH-1612 won't resolve this problem (I have explored this with a hack which fixes HHH-1612).
In my eyes there are two ways to solve this problem:
1) When cascading the save of a parent, the parent cascade can fill the persistence context with information about its collection elements. E.g. before cascading the save to a collection a parent can add a (child, parent) pair to a map in the persistence context to avoid the above described iterations. Then a simple Map#get() would be sufficient in most cases to get the parent.
2) When cascading, the parent has to be passed with the cascaded (e.g. saved) element. But this is no good solution, because it affects some well known hibernate apis.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3271) Prepare Statement Caching
by lalit railwani (JIRA)
Prepare Statement Caching
-------------------------
Key: HHH-3271
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3271
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Oracle 10g
Reporter: lalit railwani
We are using Hibernate 3.2.5 are trying to evaluate hibernate batching vis a vis JDBC batching.
As per our results the hibernate batching takes approx 2 times the time taken by JDBC batching.
The problem is we need to commit the batches also so in a loop we are commiting the transaction also (batching).
But for every new loop hibernate creates new prepared statements i.e. if we have 20 batches 20 prepared statements per table/entity are being created but in case of JDBC the same can be done using 1 prepared statement per table/entity.
Hibernate does reuse the prepared statements within a batch but not across batches. If hibernate can reuse these statements it would significantly reduce the timings and would bring the hibernate batching close to jdbc batching.
This is happening even after enabling prepare statement caching in the hibernate cfg xml.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3578) Add setReadOnly(true) method to the Criteria interface
by Graeme Rocher (JIRA)
Add setReadOnly(true) method to the Criteria interface
------------------------------------------------------
Key: HHH-3578
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3578
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1, 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1, 3.1.3, 3.2.0.alpha2, 3.2.0.alpha1, 3.1.2, 3.1.1, 3.1, 3.1 rc3, 3.1 rc2, 3.1 rc 1, 3.1 beta 2, 3.1 beta 1, 3.0.5, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0 final, 3.0 rc 1, 3.0 beta 4, 3.0 beta 3, 3.0 beta 2, 3.0 beta 1, 3.0 alpha
Reporter: Graeme Rocher
Currently the Query interface has a setReadOnly(true) method but the Criteria interface does not, this makes it impractical to use the Criteria API for read-only queries.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3772) Constraint names cannot be quoted with backticks `
by Christian (JIRA)
Constraint names cannot be quoted with backticks `
--------------------------------------------------
Key: HHH-3772
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3772
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3, all database dialects
Reporter: Christian
Priority: Minor
Table and Column names can be quoted with ` but constraint names cannot be quoted. You can reproduces the bug with the following testcase:
@javax.persistence.Entity
@javax.persistence.Table( name = "`categories`" )
abstract public class Category {
...
@org.hibernate.annotations.ForeignKey( name = "`fk_categories_parent_id`" )
@javax.persistence.ManyToOne( targetEntity = Category.class )
@javax.persistence.JoinColumn( name = "`parent_id`" )
private Category parent;
...
}
The SchemaExport (hbm2ddl) creates the following SQL statement for Postgresql:
alter table "categories" drop constraint `fk_categories_parent_id`;
drop table "categories";
create table "categories" (
...
"parent_id" int8,
...
);
alter table "categories" add constraint `fk_categories_parent_id`
foreign key ("parent_id") references "categories";
I think this problem should be fixed in the method in the class org.hibernate.mapping.Constraint in the same way as in Table.java and Column.java:
old:
public void setName(String name) {
this.name = name;
}
new:
private boolean quoted = false;
public void setName(String name) {
if ( name.charAt( 0 ) == '`' ) {
quoted = true;
this.name = name.substring( 1, name.length() - 1 );
}
else {
this.name = name;
}
}
public String getQuotedName() .. same as in Column.java
public String getQuotedName(Dialect d) { .. same as in Column.java
public boolean isQuoted() .. same as in Column.java
public String sqlDropString( ... ) {
...
return "alter table " + getTable().getQualifiedName( dialect, defaultCatalog, defaultSchema ) + " drop constraint " + getQualifiedName();
...
}
public String sqlCreateString( ... ) {
...
String constraintString = sqlConstraintString( dialect, getQualifiedName(), defaultCatalog, defaultSchema );
...
}
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HBX-936) Project cannot be deleted when there is console configuration associated with the project
by Dariusz Tylus (JIRA)
Project cannot be deleted when there is console configuration associated with the project
-----------------------------------------------------------------------------------------
Key: HBX-936
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-936
Project: Hibernate Tools
Issue Type: Bug
Components: consoleconfiguration, eclipse
Affects Versions: 3.2beta9
Environment: Eclipse 3.2, Windows XP, jdk1.5.0_8
Reporter: Dariusz Tylus
Project cannot be deleted when there is console configuration associated with the project:
Use case:
1. Create java project
2. Put jdbc driver jar file into lib filder (in the project)
3. Create console configuration for this project
4. Swich to the hibernate perspective and expand the tree for just created console configuration
5. Delete the console configuration
6. Delete the project and select option 'Also delete contents under....'
There is following error:
==
Problems encountered while deleting resources.
Could not delete: /hbmtest.
Problems encountered while deleting resources.
Problems encountered while deleting files.
Could not delete: C:\work\ORM\_tests\orm\hbmtest\lib\hsqldb-1_7_2_9.jar.
Could not delete: C:\work\ORM\_tests\orm\hbmtest\lib.
==
The problem is that jvm keeps lock on the jar file so it cannot be deleted.
Console configuration also keeps reference to the driver class.
Could the console configuration release all resources when it is deleted?
Thenx,
Dariusz
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (EJB-272) PostRemove being called before entity is actually deleted
by Paul (JIRA)
PostRemove being called before entity is actually deleted
---------------------------------------------------------
Key: EJB-272
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-272
Project: Hibernate Entity Manager
Type: Bug
Versions: 3.2.1
Environment: Hibernate 3.2.1GA Entity Manager
Hibernate core 3.2.2 GA
Oracle 9i
Windows XP professional service pack 2
No application server is being used.
Reporter: Paul
I have an EntityListener with a method annotated with postremove. It seems that the method is being called before the actual entity is deleted from the database. When configuring log4j with "debug" logging it appears that the method is being called after the PreparedStatement is created and configured but before executeUpdate() is called.
I see the following statements in my log file before my listener is called
14:06:27,024 DEBUG AbstractBatcher:476 - preparing statement
14:06:27,024 DEBUG IntegerType:133 - binding '59532' to parameter: 1
My listener is called next. Then, the prepared statement is executed.
This violates the EJB3 spec. The EJB3 spec states "The PostPersist and PostRemove methods will be invoked after the
database insert and delete operations respectively."
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3224) Invalid generated SQL for nested queries
by Adam Dyga (JIRA)
Invalid generated SQL for nested queries
----------------------------------------
Key: HHH-3224
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3224
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: MySQL
Reporter: Adam Dyga
I'm facing a problem with invalid generated SQL for nested queries.
I've the following class hierarchy (left only the most important fields for clarity):
//base class
class Asset {
String description; // <- field in base class
}
class ImageSet {
List<Wallpaper> wallpapers;
}
class Wallpaper extends Asset { // <- inherits from Asset
}
The HBM mappings:
<class name="com.company.Asset" table="Asset" abstract="true">
<property name="description" column="description" type="string" />
<id>...</id>
</class>
<class name="ImageSet" table="ImageSets">
<bag name="wallpapers" cascade="delete-orphan" inverse="true"
table="Wallpapers">
<key column="imageSetId" />
<one-to-many class="com.company.Wallpaper" />
</bag>
</class>
<joined-subclass name="com.company.Wallpaper"
extends="com.company.Asset" table="Wallpapers">
<key column="id" />
<many-to-one name="imageSet" column="imageSetId"
class="com.company.ImageSet" />
</joined-subclass>
When I try to execute the following HQL query:
select distinct imageSet from ImageSet imageSet where (select count(*) from imageSet.wallpapers w where w.description is not null) = size(imageSet.wallpapers)
I get the following SQL query:
select distinct imageset0_.id as id14_ from ImageSets imageset0_ where (select count(*) from Wallpapers wallpapers1_ where imageset0_.id=wallpapers1_.imageSetId and (wallpapers1_1_.description is not null)])=(select count(wallpapers2_.imageSetId) from Wallpapers wallpapers2_ inner join Asset wallpapers2_1_ on wallpapers2_.id=wallpapers2_1_.id where imageset0_.id=wallpapers2_.imageSetId)
The error message is
Unknown column 'wallpapers1_1_.description' in 'where clause'
which is right - note the missing wallpapers1_1_ alias which should be defined during inner join of the Wallpapers table with the base Asset table in the first nested query - just as it is done in the second nested query.
Full stack trace of any exception that occurs:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2216)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'wallpapers1_1_.description' in 'where clause'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3176)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1153)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1266)
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HSEARCH-306) Problem with composite key
by Mohit Khopkar (JIRA)
Problem with composite key
--------------------------
Key: HSEARCH-306
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-306
Project: Hibernate Search
Issue Type: Bug
Components: query
Affects Versions: 3.1.0.CR1
Reporter: Mohit Khopkar
Attachments: hibernate jira.zip
When a composite key is used and more than one results are expected , the values passed to the query are not in a proper expected order.
In the below query the parameters passed are (A00, A00),(A00, 1),(2,5) ....instead of the correct order which should be (A00,1) ,(A00,2), (A00,5)
(I have omitted the select part)..
..
where ((this_.key_client, this_.key_identifier) in ((?, ?), (?, ?), (?, ?)))
I tried to debug this issue and found that in the class org.hibernate.criterion.InExpression, the method getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) has 2 for loops , one for types and other for values. I get 2 types CustomType and LongType and so for each type it retrieves the value and adds it in the list in the order A00,A00,A00,1,2,5
I have attached the source code for your reference.
For more information, refer to the below topic on the hibernate forums:
http://forums.hibernate.org/viewtopic.php?t=992121&sid=16e54abb3dbc45d314...
--
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
15 years, 1 month