[Hibernate-JIRA] Created: (HHH-2699) Workaround for bug in PostgreSQL JDBC driver
by Matt Solnit (JIRA)
Workaround for bug in PostgreSQL JDBC driver
--------------------------------------------
Key: HHH-2699
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2699
Project: Hibernate3
Issue Type: Improvement
Affects Versions: 3.2.3
Environment: Hibernate 3.2.3, PostgreSQL 8.2.4 (Mac OS X), JDBC driver 8.2 Build 505 (JDBC 3)
Reporter: Matt Solnit
The following line (103) in org/hibernate/connection/DriverManagerConnectionProvider.java:
if (isolation!=null) pooled.setTransactionIsolation( isolation.intValue() );
causes an exception when using the PostgreSQL JDBC driver, because it does not allow you to change the transaction isolation level once a connection is in use. However, their implementation does not handle the fact that the isolation level is really not being changed in this case (because it is being set to the existing value).
The following change would work around this issue:
if ( isolation!=null && pooled.getTransactionIsolation()!=isolation.intValue() ) pooled.setTransactionIsolation( isolation.intValue() );
P.S. I know the DriverManagerConnectionProvider is not for production use, but we use it in development :-).
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-2353) ClassCastException thrown in org.hibernate.hql.ast.HqlSqlWalker.resolve
by James Andrews (JIRA)
ClassCastException thrown in org.hibernate.hql.ast.HqlSqlWalker.resolve
-----------------------------------------------------------------------
Key: HHH-2353
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2353
Project: Hibernate3
Type: Bug
Versions: 3.2.1, 3.2.0.cr4
Environment: Currently Hibernate 3.2.1, MySQL 5.0.26, Tomcat 5.5.20, Java 1.5 patch 10
Reporter: James Andrews
Above error thrown when attempting to force a left join fetch in hql on a many-to-many mapping:
Using 3 tables
accountgroup
id INTEGER PRIMARY
...
accountline
id INTEGER PRIMARY
...
accountgroupmapping
id INTEGER PRIMARY
groupId INTEGER
lineId INTEGER
...
Set mapping in hbm:
<set name="lines" table="budget.grouplinemap" fetch="join" lazy="false">
<key column="groupId" not-null="true"></key>
<many-to-many class="intranet.budget.AccountLine"
column="lineId" fetch="join" lazy="false">
</many-to-many>
</set>
HQL query executed:
select group from AccountGroup group left join fetch group.lines
Result:
java.lang.ClassCastException: org.hibernate.hql.ast.tree.SqlNode
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:722)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1105)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRefLhs(HqlSqlBaseWalker.java:4920)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1066)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3198)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
The above works fine if I remove the left join fetch, or if I make the relationship one-to-many, but when I create a many-to-many relationship the error above occurs.
But since the above is being encoded to an AJAX frontend, and the lines fields are referenced immediately, removing the left join fetch results in N+1 selects despite the fetch="join" and lazy="false" in the .hbm descriptor.
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-2811) ScrollableResults.next() generates Exception when no records were found and ScrollMode.FORWARD_ONLY is used
by Simon Jongsma (JIRA)
ScrollableResults.next() generates Exception when no records were found and ScrollMode.FORWARD_ONLY is used
-----------------------------------------------------------------------------------------------------------
Key: HHH-2811
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2811
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.ga
Environment: Oracle database 9.2.0.5.0; Oracle jdbc driver 10.2.0.2.0; JBoss 4.0.4.GA; Hibernate 3.2.0.ga
Reporter: Simon Jongsma
When using ScrollableResults with ScrollMode.FORWARD_ONLY
i could not locate a way to test (without triggering an exception) if there are any records found.
If the set is empty the next() function generates (on first call) a
GenericJDBCException: "could not perform sequential read of results (forward)".
It should return the boolean false value instead.
When there are data found the next() function will work ok &
also will correctly return false when reaching the end of the set.
A workaround (kludge) is to catch the Exception like this:
ScrollableResults foundRecs = query.scroll(ScrollMode.FORWARD_ONLY);
try {
boolean found = foundRecs.next();
} catch (GenericJDBCException e) {
if (e.getMessage().equalsIgnoreCase("could not perform sequential read of results (forward)")) {
found = false;}
else throw new DatabaseException(e.getMessage(), e);
}
if (found) ....
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-2016) Oracle9Dialect registers last_day() function as "lastday"
by Carl Lindberg (JIRA)
Oracle9Dialect registers last_day() function as "lastday"
---------------------------------------------------------
Key: HHH-2016
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2016
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.0 alpha, 3.0 beta 1, 3.0 beta 2, 3.0 beta 3, 3.0 beta 4, 3.0 rc 1, 3.0 final, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1 beta 1, 3.1 beta 2, 3.1 rc 1, 3.1 rc2, 3.1 rc3, 3.1, 3.1.1, 3.1.2, 3.2.0.alpha1, 3.2.0.alpha2, 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3
Environment: Hibernate 2.x, 3.x with an Oracle database
Reporter: Carl Lindberg
Priority: Minor
Attachments: Oracle9DialectPatch.diff, Oracle9DialectPatchOption2.diff
Oracle9Dialect.java registers a "lastday" function, however the actual Oracle function is last_day() (with the underscore). This results in a SQL error if the function is used in HQL (and obviously, HQL will not accept use of "last_day").
The patch is basically:
- registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
or, if support for the incorrect "lastday" usage should still be supported:
- registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
+ registerFunction( "lastday", new StandardSQLFunction("last_day", Hibernate.DATE) );
Both patch options are attached.
--
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, 2 months