[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2847?page=c...
]
Mikko Wilkman commented on HHH-2847:
------------------------------------
happens here as well every now and then. I'd say it fails about 1% of time so it might
be possible to make a test case to reproduce this by providing enough repetition.
The failing SQL is:
select
propertyse0_.id as id32_0_,
propertyse0_.set_name as set2_32_0_,
propertyse0_.type as type32_0_,
propertyse0_.super_set_id as super4_32_0_,
propertyse0_.updated as updated32_0_,
propertyse0_.description as descript6_32_0_
from property_set propertyse0_
where this_.set_name=?
and the code is pretty simple too:
PropertySet propertySet = (PropertySet) getSession().createCriteria(PropertySet.class)
.add(Restrictions.eq("name", name))
.uniqueResult();
An interesting find by one of our developers is that all the cases here with problems seem
to have "name" as the name of the problematic property (we're mapping the
set_name in the DB as "name" in the bean).
THIS_"."NAME": invalid identifier when using
createCriteria with addOrder
-------------------------------------------------------------------------
Key: HHH-2847
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2847
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.0.5
Environment: Oracle - 10.2.0
Reporter: Ashish Tiwari
Assignee: Diego Plentz
We are using hibernate 3.0.5 and once a while I see following error getting generated due
to incorrect SQL generated by hibernate:
Hibernate: select systembean0_.SYSTEMID as SYSTEMID12_0_, systembean0_.Version as
Version12_0_, systembean0_.NAME as NAME12_0_, systembean0_.TYPE as TYPE12_0_,
systembean0_.DESCRIPTION as DESCRIPT5_12_0_ from SDSYSTEM systembean0_ order by this_.NAME
asc
- SQL Error: 904, SQLState: 42000
- ORA-00904: "THIS_"."NAME": invalid identifier
This normally works but occasionally we run into the issue mentioned above. I do not see
alias "this_" in the sql query and I think that causes the error to happen.
Issue is caused by alias not used consistently.
In normal case the generated SQL looks like following:
Hibernate: select this_.SYSTEMID as SYSTEMID7_0_, this_.Version as Version7_0_,
this_.NAME as NAME7_0_, this_.TYPE as TYPE7_0_, this_.DESCRIPTION as DESCRIPT5_7_0_ from
SDSYSTEM this_ order by this_.NAME asc
I am not sure what causes this problem. Has anyone else see similar problem earlier?
I appreciate any help with this. Below is other information:
Hibernate version: 3.0.5
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.avaya.coreservice.admin.toolkit.common.system.SystemBean"
table="SDSYSTEM">
<id name="uniqueId" type="java.lang.String">
<column name="SYSTEMID" length="50" not-null="true"/>
<generator class="uuid"/>
</id>
<version name="version" column="Version" />
<property
name="name"
type="java.lang.String">
<column name="NAME" length="512" not-null="true"/>
</property>
<property
name="type"
type="java.lang.String">
<column name="TYPE" length="50" not-null="false"/>
</property>
<property
name="description"
type="java.lang.String">
<column name="DESCRIPTION" length="1024"
not-null="false"/>
</property>
<set name="resourceBeanSet">
<key>
<column name="SYSTEMID" length="50"
not-null="false"/>
</key>
<one-to-many
class="com.avaya.coreservice.admin.toolkit.common.resource.ResourceBean"/>
</set>
<set name="siteBeanSet" order-by="name asc">
<key>
<column name="SYSTEMID" length="50"
not-null="false"/>
</key>
<one-to-many
class="com.avaya.coreservice.admin.toolkit.common.site.SiteBean"/>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
HibernateUtil.getSession().createCriteria(SystemBean.class)
.addOrder(Order.asc("name")).list();
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Oracle - 10.2.0
The generated SQL (show_sql=true):
select systembean0_.SYSTEMID as SYSTEMID12_0_, systembean0_.Version as Version12_0_,
systembean0_.NAME as NAME12_0_, systembean0_.TYPE as TYPE12_0_, systembean0_.DESCRIPTION
as DESCRIPT5_12_0_ from SDSYSTEM systembean0_ order by this_.NAME asc
I appreciate any help with this.
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