[Hibernate-JIRA] Created: (HHH-3551) Boolean substitution in informix
by Rouvignac (JIRA)
Boolean substitution in informix
--------------------------------
Key: HHH-3551
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3551
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.3.1
Environment: Hibernate 3.2
Informix 9.40
Reporter: Rouvignac
HQL Query :
select order from Order order where order.printed = ?
Parameter :
true, false, Boolean.TRUE or Boolean.FALSE
When the request is executed we get the following error :
SQLSTATE: IX000
SQL CODE: -674
674: Routine (equal) can not be resolved.
If as parameter we use "t" ot "f" everything works fine but it will not work with other DB.
As a workaround we can use :
property name="hibernate.query.substitutions">true t, false f</property>
I investigated in Dialects :
Dialect.java
public String toBooleanValueString(boolean bool) {
return bool ? "1" : "0";
}
PostgreSQLDialect.java
public String toBooleanValueString(boolean bool) {
return bool ? "true" : "false";
}
InformixDialect.java uses Dialect.java toBooleanValueString method.
In my mind toBooleanValueString should be added to InformixDialect.java as follow :
public String toBooleanValueString(boolean bool) {
return bool ? "t" : "f";
}
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-4511) Problems with polymorphic queries with SINGLE_TABLE inheritance strategy
by Karoly Gacsal (JIRA)
Problems with polymorphic queries with SINGLE_TABLE inheritance strategy
------------------------------------------------------------------------
Key: HHH-4511
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4511
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.0.Beta-1
Environment: envers 1.2.1
Hibernate 3.3.2
Reporter: Karoly Gacsal
Attachments: ChildAuditing.java
Inheritance strategy is SINGLE_TABLE (discriminator).
When I query for ParentType I do not get ChildType instances in the result, but ParentType instances.
I checked the problem against envers 1.2.1/Hibernate 3.3.2 and against Hibernate 3.5.0.Beta-1 too.
The testcase "\src\test\java\org\hibernate\envers\test\integration\inheritance\single\ChildAuditing.java"
passes, but when I change the two sides of the equals method in testPolymorphicQuery()'s second assert the testcase fails, because
the expected result is a ChildEntity, but in the result we get an instance of ParentEntity.
Attached you can find the testcases changed by me.
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-5621) NPE (in ReflectHelper.getConstructor) during createQuery without alias with one entity (wich use several tables)
by Félix Gerzaguet (JIRA)
NPE (in ReflectHelper.getConstructor) during createQuery without alias with one entity (wich use several tables)
----------------------------------------------------------------------------------------------------------------
Key: HHH-5621
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5621
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0.CR2
Environment: Gentoo Linux
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Hibernate 3.6.0.CR2
tested DB: PostgreSQL 8.4, HSQLDB 1.8.0.10
Reporter: Félix Gerzaguet
Priority: Minor
Attachments: TestCaseCreateQueryWithoutAliasNPE.jar
During a session.createQuery like:
Query query6 = session.createQuery("select new Something(id, event, dummyField) " +
"from Something" );
A NPE is thrown:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:343)
at org.hibernate.hql.ast.tree.ConstructorNode.resolveConstructor(ConstructorNode.java:176)
at org.hibernate.hql.ast.tree.ConstructorNode.prepare(ConstructorNode.java:150)
at org.hibernate.hql.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.java:996)
I join an test case.
All versions of hibernate seems affected (from 3.2.6.ga to 3.6.0.RC2).
This is a minor issue since an easy workaround is available: you just have to use an alias to qualifie the properties
For the preceding example, we will have:
Query query3 = session.createQuery("select new Something(sthg.id, sthg.event, sthg.dummyField) " +
"from Something sthg" );
Possible fix:
As described in the testCase, I fix this by a one character fix:
In org.hibernate.hql.ast.HqlSqlWalker in method isNonQualifiedPropertyRef,
change from
if ( fromElements.size() == 1 ) {
to
if ( fromElements.size() >= 1 ) {
This could means that when a property is not qualified, we leave a chance for this property to be found on the first explicit element of the from clause.
I test this fix on the 3.5.5-Final code and I was able to run the test suite without failures.
I can't think of a test case in which this fix could lead to a regression but I'm not an Hibernate Guru so comments are welcome.
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-5666) Missing table alias for one column in generated sql
by Jakub Jankowski (JIRA)
Missing table alias for one column in generated sql
---------------------------------------------------
Key: HHH-5666
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5666
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0-CR-2
Environment: Hibernate 3.5.0-CR-2, MySQL
Reporter: Jakub Jankowski
Column 'desc' in generated sql doesn't have table alias 'announceme0_' (unlike the rest of columns) which genereates error while executing.
Genereted sql:
select announceme0_.announcementID as announce1_1_0_,
announceme0_.oceaneqID as oceaneqID1_0_,
announceme0_.fileName as fileName1_0_,
desc as desc1_0_
from test.announcement announceme0_ where announceme0_.announcementID=1
Mapping for the table:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2010-09-01 12:28:56 by Hibernate Tools 3.1.0.beta4 -->
<hibernate-mapping>
<class name="all.model.Announcement" table="announcement" catalog="test">
<id name="announcementId" type="int">
<column name="announcementID" />
<generator class="assigned" />
</id>
<property name="oceaneqId" type="java.lang.Integer">
<column name="oceaneqID" />
</property>
<property name="fileName" type="string">
<column name="fileName" length="1024" />
</property>
<property name="desc" type="string">
<column name="desc" length="1024" />
</property>
<set name="routeOnAnnouncements" inverse="true">
<key>
<column name="announcementID" />
</key>
<one-to-many class="all.model.RouteOnAnnouncement" />
</set>
</class>
</hibernate-mapping>
There's no such problem with other tables.
--
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
13 years, 5 months