[Hibernate-JIRA] Created: (HHH-2158) incorrect hql query on one-to-one with property-ref
by Sebastien Cesbron (JIRA)
incorrect hql query on one-to-one with property-ref
----------------------------------------------------
Key: HHH-2158
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2158
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: hibernate 3.2.0.ga with firebird 1.5.3 and jaybird 1.5.5 driver on windows XP
Reporter: Sebastien Cesbron
Attachments: testhib.zip
I have a one-to-one relationship with property-ref between Master and Slave2.
I want to find all Master instances that have a null Slave2 instance associated.
To do so my query is
select master from Master master where master.slave2 is null
The sql generated is
select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_ where master0_.oid is null
which seems incorrect. It checks here Master instances with null id (config files are listed below).
If I do my query like this
select master from Master master where master.slave2.oid is null
the generated sql is ok :
select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_, Slave2 slave2x1_ where master0_.oid=slave2x1_.myMaster and (slave2x1_.oid is null)
I have attached a small eclipse project that reproduces the problem
This problem may-be related to the one I have submitted as issue HHH-1849
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HBX-948) org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
by Sathish P (JIRA)
org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
--------------------------------------------------------------------------------------------
Key: HBX-948
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-948
Project: Hibernate Tools
Issue Type: Bug
Components: consoleconfiguration
Affects Versions: 3.1.beta5
Environment: Eclipse
Reporter: Sathish P
WARN Finalizer org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
java.sql.SQLException: Io exception: Socket closed
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:481)
at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1203)
at org.hibernate.connection.DriverManagerConnectionProvider.close(DriverManagerConnectionProvider.java:152)
at org.hibernate.connection.DriverManagerConnectionProvider.finalize(DriverManagerConnectionProvider.java:142)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-4915) <list-index> base attribute ignored on insert for a bidirectional association (one-to-many)
by Olivier Lafontaine (JIRA)
<list-index> base attribute ignored on insert for a bidirectional association (one-to-many)
-------------------------------------------------------------------------------------------
Key: HHH-4915
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4915
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-CR-1, 3.3.2
Environment: Hibernate 3.3.2GA and 3.5.0-CR-1
Oracle Database
Reporter: Olivier Lafontaine
Attachments: hibernate-poc-jira.zip
My mapping looks like the following:
{code:xml}
<hibernate-mapping>
<class name="Parent">
<!-- SNIP -->
<list name="children" table="CHILD" cascade="all-delete-orphan">
<key column="ID_PARENT" not-null="true" />
<list-index base="1">
<column name="IDX" check="IDX > 0" />
</list-index>
<one-to-many class="Child" />
</list>
</class>
<class name="Child">
<!-- SNIP -->
<many-to-one name="parent" class="Parent" column="ID_PARENT"
not-null="true" insert="false" update="false" />
</class>
</hibernate-mapping>
{code}
As you can see from the mapping, we have a parent entity ({{Parent}}) referring child entities ({{Child}} using the {{children}} accessor). The index column ({{ORDER}}) is not an attribute in the child entity, so I referred to the second use case in section _6.3.3. Bidirectional associations with indexed collections_ of the reference guide to do my mapping.
Everything works except for the index base, it is always 0 based on insert. I've tried both Hibernate 3.3.2GA and the latest development version (3.5.0-CR-1), the issue can be reproduced in both.
I've joined a test case to reproduce the problem. While working on it, I realized there are updates after the inserts setting the correct index. However, we cannot change the database schema and there's a constraint on the index column enforcing a value > 0. So this issue is really important for us. I could manually handle the index values, but it would be so much easier to let Hibernate do it.
I've traced the problem and it seems that {{StatefulPersistenceContext#getIndexInParent(..)}} does not considers the index base. Why are updates necessary after the inserts? It looks to me like Hibernate could correctly set the index parameter on the insert statements.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-5072) Invalid SQL produced when using FetchMode.SUBSELECT with SQLServerDialect
by kabram (JIRA)
Invalid SQL produced when using FetchMode.SUBSELECT with SQLServerDialect
-------------------------------------------------------------------------
Key: HHH-5072
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5072
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: Hibernate core 3.5, JPA 2.0, SQL Server 2005, JDK 1.6
Reporter: kabram
Priority: Blocker
I have a parent entity with child entities being loaded using SubSelect and eager fetching. I execute a query to retrieve all parents and get the following query which SQL Server 2005 does not support:
select
childtab0_.CONFIG_KEY as CONFIG5_23_1_,
childtab0_.QUALIFIER as QUALIFIER23_1_,
childtab0_.CONFIG_VALUE_ID as CONFIG1_1_,
childtab0_.CONFIG_VALUE_ID as CONFIG1_24_0_,
childtab0_.CONFIG_KEY as CONFIG5_24_0_,
childtab0_.QUALIFIER as QUALIFIER24_0_,
childtab0_.CONFIG_VALUE as CONFIG2_24_0_,
childtab0_.IS_ENCRYPTED as IS3_24_0_,
childtab0_.LIST_ORDER as LIST4_24_0_
from
TEST_CHILD_TABLE childtab0_
where
(childtab0_.CONFIG_KEY, childtab0_.QUALIFIER) in
(select parenttab0_.CONFIG_KEY, parenttab0_.QUALIFIER
from RSS_NEO_CANYON_CONFIG_KEY parenttab0_ )
order by
childtab0_.LIST_ORDER asc
SQL Server does not like the tuple in the where clause.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-2666) subselect fetching ignores max results
by James Roper (JIRA)
subselect fetching ignores max results
--------------------------------------
Key: HHH-2666
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2666
Project: Hibernate3
Issue Type: Improvement
Components: query-hql, query-sql
Affects Versions: 3.2.1
Environment: Hibernate 3.2.1
HSQLDB 8.0
Reporter: James Roper
Priority: Minor
When maxResults is set for a query, the hibernate subselect fetching strategy ignores it. For example, I have a class entry, that has a list of comments, which are configured to use the subselect fetching strategy. You can see that in the original query, only the top ? results are fetched:
select
top ? entry0_.id as id0_,
entry0_.title as title0_,
entry0_.entry as entry0_,
entry0_.time as time0_,
entry0_.category_id as category5_0_
from
Entry entry0_
order by
entry0_.time desc
But then when it does the sub select query to lazily load the comments, this is the query it runs:
select
comments0_.entry_id as entry5_1_,
comments0_.id as id1_,
comments0_.id as id1_0_,
comments0_.time as time1_0_,
comments0_.comment as comment1_0_,
comments0_.author as author1_0_
from
Comment comments0_
where
comments0_.entry_id in (
select
entry0_.id
from
Entry entry0_
)
order by
comments0_.time desc
So, it loads every single comment in the database, even though only the comments for the top ? entries are needed. Of course, if there was no order by clause on the first query, the sub select may not return the same results, so it should probably only do this when there is an order by clause in the first query, and it should make sure it includes the order by clause in the sub select.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (ANN-609) Need a way to specify "unsaved-value" strategy using annotations
by Suji Suresh (JIRA)
Need a way to specify "unsaved-value" strategy using annotations
----------------------------------------------------------------
Key: ANN-609
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-609
Project: Hibernate Annotations
Issue Type: Bug
Environment: Hibernate 3.2.2, Hibernate-annotations 3.2.1
Reporter: Suji Suresh
Hibernate has two ways of specifying a value for primary key:
1. Assign a value before handing it over to Hibernate
2. Have Hibernate generate the value before persisting
In my project I have objects of both of the above specified types. In other words I assign value for the primary key for some the objects (lets call these objects "assigned") and for others I have Hibernate generate the value before persisting (lets call these objects "generated"). Since Hibernate annotations does not support "unsaved-value", I do not have a way of specifying "unsaved-value" strategy. While my "generated" objects work perfectly with Hibernate's default "unsaved-value" strategy, I see wrong (but expected) behaviour when I try to persist an "assigned" object that is already present in the database in that, I get StaleStateException instead of DataIntegrityViolationException
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-3724) Bug in determining the getter method for property
by Senthil (JIRA)
Bug in determining the getter method for property
--------------------------------------------------
Key: HHH-3724
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3724
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: hibernate-core-3.3.1.GA.jar, Oracle Express Edition 10g
Reporter: Senthil
Priority: Minor
I have an entity class with a property "String nextOnError" mapping to the database column "varchar nextOnError". I have a getter method "String getNextOnError()" defined in the class. But I also have another method "boolean isNextOnError()" for my other processing in the application. I was expecting hibernate would pick the getter method "String getNextOnError()" as the getter method but it is not. It is always picking the "boolean isNextOnError()" and resulting in "Class cast exception: java.lang.Boolean" during insertion. This is because, for each property, in the class "org.hibernate.property.BasicPropertyAccessor", the method "getterMethod(Class theClass, String propertyName)" is looping through all the getter methods with no arguments. The loop breaks when it finds any method starts with either "isNextOnError()" or "getNextOnError()". Unfortunately, in my case, it always ends up with "boolean isNextOnError()". I think the correct way is to check all the methods for starting with get... and if nothing is found, then start looking for method starting with 'is...' .
Thanks.
--
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
12 years, 6 months
[Hibernate-JIRA] Created: (HHH-4504) Query on polyphomic association
by Rafael Santini (JIRA)
Query on polyphomic association
-------------------------------
Key: HHH-4504
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4504
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: MySQL 5.0.51a-community-nt
Reporter: Rafael Santini
The following query on a polyphormic association does not works:
from Pessoa where nome = 'Rafael';
Error: Unknown column 'pessoa1_1_.nome' in 'where clause'
Mapping:
<class name="Pessoa" table="bs_com_pessoa">
<id name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<joined-subclass name="PessoaFisica" table="bs_com_pessoa_fisica">
<key column="id_pessoa"/>
<property column="nome" name="nome" not-null="true"/>
</joined-subclass>
<joined-subclass name="PessoaJuridica" table="bs_com_pessoa_juridica">
<key column="id_pessoa"/>
<property name="razaoSocial" column="razao_social" not-null="true"/>
<property name="nomeFantasia" column="nome_fantasia" not-null="true"/>
</joined-subclass>
</class>
<class name="Cliente" table="bs_erp_cliente">
<id name="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<many-to-one name="pessoa" class="Pessoa" column="id_pessoa" not-null="true" unique="true" cascade="all"/>
</class>
SQL generated by Hibernate:
select cliente0_.id as id18_, cliente0_.id_pessoa as id2_18_ from bs_erp_cliente cliente0_, bs_com_pessoa pessoa1_ where cliente0_.id_pessoa=pessoa1_.id and (pessoa1_1_.nome like ?) order by pessoa1_1_.nome
There is not pessoa1_1_ in the from clause.
--
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
12 years, 6 months