[Hibernate-JIRA] Created: (HHH-2734) PreparedStatement leak with lazy properties
by Christian Gruber (JIRA)
PreparedStatement leak with lazy properties
-------------------------------------------
Key: HHH-2734
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2734
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4
Environment: Hibernate 3.2.4
Oracle 10g
Sun Java 1.5.0
Reporter: Christian Gruber
Priority: Critical
Hello!
When iterating through more than 300 elements that have lazy properties, I get an ORA-01000 JDBC error ("maximum open cursors exceeded"). I found out that the root cause for this are unclosed prepared statements in AbstractBatcher.prepareSelectStatement(String). When I add the generated prepared statement to the statementsToClose set in this method, the problem vanishes. But I don't have an idea what other effects this might have, and why the prepared statement was not added to the statements to close in the first place.
How to reproduce:
- Make a class with at least one lazy property; instrument the byte code
- Create an Oracle database with at least 300 entries in the table for this class
- Execute the following code:
Iterator<MyClass> it = session.createQuery("from MyClass mc").iterate();
while (it.hasNext()) {
MyClass mc = it.next();
String la = mc.getLazyAttribute();
session.evict(mc);
}
- Watch the log for org.hibernate.jdbc.AbstractBatcher entries containing
"about to open ResultSet" and see the numbers increase
As already mentioned, a simple fix for this is adding "statementsToClose.add( ps );" into AbstractBatcher.java, around line 133 (assigning the PreparedStatement to a new variable "ps" first, of course), but as I don't understand the differences between the various PreparedStatement generating methods there, that might give rise to other problems.
Thanks for looking at it,
Christian
--
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
[Hibernate-JIRA] Created: (HHH-2593) Keyword UNION is prefixed with "this_." in filter conditions
by Frederic Leitenberger (JIRA)
Keyword UNION is prefixed with "this_." in filter conditions
------------------------------------------------------------
Key: HHH-2593
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2593
Project: Hibernate3
Issue Type: Bug
Components: query-hql, query-sql
Affects Versions: 3.2.1
Environment: Oracle 10g: org.hibernate.dialect.OracleDialect
Suse Linux
Hibernate: 3.2.1.ga
Hibernate Annotations: 3.2.1.GA
Reporter: Frederic Leitenberger
Priority: Trivial
I need to use a UNION-Subquery in a Filter condition unless HHH-298 is solved.
But anyway, when using the keyword "union" in the Filter condition it is prefixed with "this_.".
For instance, this ...
@Filter(name = "resellerFilter", condition = "(select cu.resellerId from Customer cu, GeoNumber gn where (cu.id = gn.customerId and gn.id = this_.geoNumberId) UNION select cu.resellerId from Customer cu where cu.detemeTemplateId = this_.id) in (null, :resellerIds)")
... produces this ...
select
...
from
DeTeMe this_
where
(
select
cu.resellerId
from
Customer cu,
GeoNumber gn
where
(
cu.id = gn.customerId
and gn.id = this_.geoNumberId
) this_.UNION select
cu.resellerId
from
Customer cu
where
cu.detemeTemplateId = this_.id
) in (
null, ?
)
and this_.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
17 years
[Hibernate-JIRA] Created: (HHH-2750) Oracle9i dialect do not support SequenceStyleGenerator
by Richard Lee (JIRA)
Oracle9i dialect do not support SequenceStyleGenerator
------------------------------------------------------
Key: HHH-2750
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2750
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Environment: Oracle9i
Reporter: Richard Lee
Attachments: dynamicMap.hbm.xml
In the hibernate.cfg.xml set :
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hbm2ddl.auto">update</property>
Java Code:
private void createSubnet() {
Session session = HibernateSessionFactory.getSession();
HashMap<String, Object> subNet = new HashMap<String, Object>();
subNet.put("ISDELETE", Boolean.FALSE);
Timestamp now = DateUtil.getNow();
subNet.put("CREATE_TIME", now);
subNet.put("LAST_MODIFY_TIME", now);
Transaction tx = session.beginTransaction();
session.save("SUB_NET", subNet);
tx.commit();
session.flush();
HibernateSessionFactory.closeSession();
}
Exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.dialect.Dialect.getCreateSequenceStrings(Ljava/lang/String;II)[Ljava/lang/String;
at org.hibernate.id.enhanced.SequenceStructure.sqlCreateStrings(SequenceStructure.java:97)
at org.hibernate.id.enhanced.SequenceStyleGenerator.sqlCreateStrings(SequenceStyleGenerator.java:168)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:1051)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:314)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
at com.ultrapower.oe.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:89)
at com.ultrapower.oe.util.HibernateSessionFactory.getSession(HibernateSessionFactory.java:63)
--
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
[Hibernate-JIRA] Created: (HHH-2297) invalid id type error message doesn't report which entity
by Kelly Campbell (JIRA)
invalid id type error message doesn't report which entity
---------------------------------------------------------
Key: HHH-2297
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2297
Project: Hibernate3
Type: Patch
Components: metamodel
Versions: 3.2.0.ga
Reporter: Kelly Campbell
Priority: Minor
Attachments: hibernate-id-type.patch
The error message given here makes it very hard to determine what entity has the problem.
Simple patch is attached.
java.lang.UnsupportedOperationException: not a valid id type
at org.hibernate.type.CharacterType.getDefaultValue(CharacterType.java:20)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:48)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.EntityMetamodel.(EntityMetamodel.java:114)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:418)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:223)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
--
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
[Hibernate-JIRA] Created: (HHH-2261) Setting hibernate.hbm2ddl.auto=validate causes problems on mySQL with numeric fields
by Christian Sprajc (JIRA)
Setting hibernate.hbm2ddl.auto=validate causes problems on mySQL with numeric fields
------------------------------------------------------------------------------------
Key: HHH-2261
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2261
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Reporter: Christian Sprajc
Hello,
We got a Problem when using the following setup:
1) JBoss 4.0.4A with Hibernate 3.2.0 / mySQl 4.x AND 5.x
2) Set hibernate.hbm2ddl.auto=validate
3) Using a usertype which uses the SQL type: Types.NUMERIC
When deploying our application I got the following error:
12:43:21,985 INFO [TableMetadata] columns: [paymenttype, amount, oid, remarks, currency, ae_date]
12:43:21,985 WARN [ServiceController] Problem starting service persistence.units:jar=com.riege.pogo_0.1.4.jar,unitName=PogoEntityManager
org.hibernate.HibernateException: Wrong column type: amount, expected: numeric(19,2)
at org.hibernate.mapping.Table.validateColumns(Table.java:251)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1002)
The Problem is:
1) When hibernate creates (e.g. hibernate.hbm2ddl.auto=update) through the columns in the mySQL database it creates it as "numeric(x,y)" field.
2) mySQL always converts "numeric(x,y)" to "decimal(x,y)". The metadata returns "decimal(x,y)"
3) When deploying with "hibernate.hbm2ddl.auto=validate" to error above is thrown. The problem is that hibernate expects a "numeric(x,y)" type but mysql returns a "decimal(x,y)"
A workaround I'm now using is a fixed mySQL dialect which correctly handles Types.DECIMAL / "decimal(x,y)":
public class FixedMySQLDialect extends org.hibernate.dialect.MySQLDialect {
public FixedMySQLDialect() {
super();
registerColumnType(Types.NUMERIC, "decimal(19, $l)");
registerColumnType(Types.DECIMAL, "decimal(19, $l)");
}
}
--
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