[Hibernate-JIRA] Created: (HHH-2348) <org.hibernate.util.JDBCExceptionReporter> <000000> <Invalid column name> Exception in Named Query
by Srikant Panda (JIRA)
<org.hibernate.util.JDBCExceptionReporter> <000000> <Invalid column name> Exception in Named Query
--------------------------------------------------------------------------------------------------
Key: HHH-2348
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2348
Project: Hibernate3
Type: Bug
Components: query-sql
Environment: Hibernate 3, Oracle9
Reporter: Srikant Panda
I am trying to use "getNamedQuery". When I run the SQL, as shown by putting the property "hibernate.show_sql" in config file, The SQL Runs perfectly fine. but in Hibernate it is throwing an exception of "invalid Column", What is annoying is , It worked fine when I was not using named query.
below is the copy of my hibernate.cfg.xml
==============================
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.username">pdbread</property>
<property name="connection.url">
jdbc:oracle:thin:@chi1dds1:1521:pdbdev
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">PDBDEV</property>
<property name="connection.password">owner</property>
<property name="hibernate.show_sql">true</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<mapping resource="com/uscellular/shared/services/hibernate/Organization.hbm.xml" />
</session-factory>
</hibernate-configuration>
========================
The Organization.hbm.xml file
=====================
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.uscellular.shared.services.hibernate.Organization" table="ORGANIZATION" schema="PDBREAD">
<id name="organizationKey" type="java.lang.Long">
<column name="ORGANIZATION_KEY" precision="10" scale="0" />
<generator class="assigned" />
</id>
<property name="region" type="java.lang.String">
<column name="REGION" length="30" />
</property>
<property name="clusterDesc" type="java.lang.String">
<column name="CLUSTER_DESC" length="30" />
</property>
<property name="submarketId" type="java.lang.String">
<column name="SUBMARKET_ID" length="3" />
</property>
<property name="submarketDesc" type="java.lang.String">
<column name="SUBMARKET_DESC" length="30" />
</property>
<property name="marketStatus" type="java.lang.String">
<column name="MARKET_STATUS" length="1" />
</property>
<property name="dataCenter" type="java.lang.String">
<column name="DATA_CENTER" length="3" />
</property>
<property name="roamingAdminFee" type="java.lang.Double">
<column name="ROAMING_ADMIN_FEE" precision="9" />
</property>
<property name="networkSurcharge" type="java.lang.Double">
<column name="NETWORK_SURCHARGE" precision="9" />
</property>
<property name="state911Fee" type="java.lang.Double">
<column name="STATE_911_FEE" precision="9" />
</property>
<property name="state911FeeType" type="java.lang.String">
<column name="STATE_911_FEE_TYPE" length="3" />
</property>
<property name="additionalComments" type="java.lang.String">
<column name="ADDITIONAL_COMMENTS" length="2000" />
</property>
<property name="caresModificationDate" type="java.util.Date">
<column name="CARES_MODIFICATION_DATE" length="7" />
</property>
<property name="modificationDate" type="java.util.Date">
<column name="MODIFICATION_DATE" length="7" />
</property>
<property name="modificationUser" type="java.lang.String">
<column name="MODIFICATION_USER" length="10" />
</property>
<property name="approvalDate" type="java.util.Date">
<column name="APPROVAL_DATE" length="7" />
</property>
<property name="approvalUser" type="java.lang.String">
<column name="APPROVAL_USER" length="10" />
</property>
<property name="lastReleaseDate" type="java.util.Date">
<column name="LAST_RELEASE_DATE" length="7" />
</property>
<property name="clusterId" type="java.lang.Long">
<column name="CLUSTER_ID" precision="10" scale="0" not-null="true" />
</property>
</class>
<sql-query name="GetAllOrganization">
<return alias="Organization" class="com.uscellular.shared.services.hibernate.Organization">
<return-property name="ORGANIZATION_KEY" column="organizationKey"/>
<return-property name="REGION" column="region"/>
<return-property name="CLUSTER_DESC" column="clusterDesc"/>
<return-property name="SUBMARKET_ID" column="submarketId"/>
<return-property name="SUBMARKET_DESC" column="submarketDesc"/>
<return-property name="MARKET_STATUS" column="marketStatus"/>
<return-property name="DATA_CENTER" column="dataCenter"/>
<return-property name="ROAMING_ADMIN_FEE" column="roamingAdminFee"/>
<return-property name="NETWORK_SURCHARGE" column="networkSurcharge"/>
<return-property name="STATE_911_FEE" column="state911Fee"/>
<return-property name="STATE_911_FEE_TYPE" column="state911FeeType"/>
<return-property name="ADDITIONAL_COMMENTS" column="additionalComments"/>
<return-property name="CARES_MODIFICATION_DATE" column="caresModificationDate"/>
<return-property name="MODIFICATION_DATE" column="modificationDate"/>
<return-property name="MODIFICATION_USER" column="modificationUser"/>
<return-property name="APPROVAL_DATE" column="approvalDate"/>
<return-property name="APPROVAL_USER" column="approvalUser"/>
<return-property name="LAST_RELEASE_DATE" column="lastReleaseDate"/>
<return-property name="CLUSTER_ID" column="clusterId"/>
</return>
select organization_key AS organizationKey, region AS region, cluster_desc AS clusterDesc, submarket_id AS submarketId, submarket_desc AS submarketDesc, market_status AS marketStatus, data_center AS dataCenter, nvl(roaming_admin_fee,0) AS roamingAdminFee, nvl(network_surcharge,0) AS networkSurcharge, nvl(state_911_fee,0) AS state911Fee, state_911_fee_type AS state911FeeType, additional_comments AS additionalComments, cares_modification_date AS caresModificationDate, modification_date AS modificationDate, modification_user AS modificationUser, approval_date AS approvalDate, approval_user AS approvalUser, last_release_date AS lastReleaseDate, cluster_id AS clusterId from organization
</sql-query>
</hibernate-mapping>
===========================
when I make a call like this
>>>>
public Organization[] getAll() {
List<Organization> retList;
Organization[] org= null;
try {
org.hibernate.Session s = getSession();
retList = s.getNamedQuery("GetAllOrganization").list();
org = new Organization[retList.size()];
retList.toArray(org);
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
return org;
}
>>>>>
I get an Exception as below
Hibernate: select organization_key AS organizationKey, region AS region, cluster_desc AS clusterDesc, submarket_id AS submarketId, submarket_desc AS submarketDesc, market_status AS marketStatus, data_center AS dataCenter, nvl(roaming_admin_fee,0) AS roamingAdminFee, nvl(network_surcharge,0) AS networkSurcharge, nvl(state_911_fee,0) AS state911Fee, state_911_fee_type AS state911FeeType, additional_comments AS additionalComments, cares_modification_date AS caresModificationDate, modification_date AS modificationDate, modification_user AS modificationUser, approval_date AS approvalDate, approval_user AS approvalUser, last_release_date AS lastReleaseDate, cluster_id AS clusterId from organization
<Jan 9, 2007 12:04:00 AM CST> <Warning> <org.hibernate.util.JDBCExceptionReporter> <000000> <SQL Error: 17006, SQLState: null>
<Jan 9, 2007 12:04:00 AM CST> <Error> <org.hibernate.util.JDBCExceptionReporter> <000000> <Invalid column name>
<Jan 9, 2007 12:04:00 AM CST> <Error> <com.uscellular.shared.services.hibernate.OrganizationDAO> <000000> <get failed
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1518)
at org.hibernate.loader.Loader.list(Loader.java:1498)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:103)
Truncated. see log file for complete stacktrace
java.sql.SQLException: Invalid column name
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:208)
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3291)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1914)
Truncated. see log file for complete stacktrace
>
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1518)
at org.hibernate.loader.Loader.list(Loader.java:1498)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:103)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1340)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:151)
at com.uscellular.shared.services.hibernate.OrganizationDAO.getAll(OrganizationDAO.java:68)
Any help in this is appreciated, I am wondering, why this could be a problem, ( because of any mistake in my configuration or .hbm.xml file ) or something else. when the sql is perfectly running file
I have tried to remove the 'AS' clause in SQL - did not work
I tried to put like ' ORGANIZATION_KEY AS Organization.organizationKey ' = did not work
I tried to put ' From Organization org ' alias in table name - did not work
I have tried putting the Oracle schema.table name in the query - Did not work.
please help !!!!!!!!!!!!!!!!!! have already spent a week worth of time on this issue already.
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2349) Hibernate Query problem with ORER BY, Pagination, Oracle and large datasets
by Ronny Fries (JIRA)
Hibernate Query problem with ORER BY, Pagination, Oracle and large datasets
---------------------------------------------------------------------------
Key: HHH-2349
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2349
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.1.2
Environment: Java5
Spring 2
Hibernate 3.1.2
Oracle 10g R2
Reporter: Ronny Fries
Attachments: custtest.zip
Hibernate has a problem when selecting a small data set out of a large amount of ORDERED data.
Please see the following scenario:
Please see the attached sources, if you add them to an eclipse project edit the database.properties file and also add the correct libraries (hibernate, spring, oracle ....), you should be able to run the JUnit Test CSTest.java
The first test inserts 1.000.000 records into a customer table on the database (you can edit the number of loops to manipulate the number of entered records.
The following three test cases try to select record 990000 to 991000 out of the ORDERED dataset in three different ways.
Here are the results that I got when measuring the processing time (i measured the java app exec time and in contrast the time when executing the "generated" statement on the database itself):
getOrderCustomersWithSpringTemplate1
Generated Statement:
select * from ( select row_.*, rownum rownum_ from ( select this_.id as id3_0_, this_.version as version3_0_, this_.name as name3_0_, this_.type as type3_0_, this_.marketstatus as marketst5_3_0_ from Customer this_ order by this_.id asc ) row_ ) where rownum_ <= ? and rownum_ > ?
Processing Time on Database itself: 6101 milliseconds (ms)
Processing Time in Application (including database access): 14149 ms
getOrderCustomersWithSpring1
Generated Statement:
select * from ( select row_.*, rownum rownum_ from ( select customer0_.id as id3_, customer0_.version as version3_, customer0_.name as name3_, customer0_.type as type3_, customer0_.marketstatus as marketst5_3_ from Customer customer0_ order by customer0_.id ) row_ ) where rownum_ <= ? and rownum_ > ?
Processing Time on Database itself: 4023 ms
Processing Time in Application (including database access): 12489 ms
getOrderCustomersWithSpring2
Generated Statement:
select * from ( select row_.*, rownum rownum_ from ( select this_.id as id3_0_, this_.version as version3_0_, this_.name as name3_0_, this_.type as type3_0_, this_.marketstatus as marketst5_3_0_ from Customer this_ order by this_.id asc ) row_ ) where rownum_ <= ? and rownum_ > ?
Processing Time on Database itself: 5210 ms
Processing Time in Application (including database access): 13022 ms
When switching on debugging, it can be seen that Hibernate halts at the following line in any of the above cases (this seems to be the time that is missing between the database processing and the application processing):
2006-12-21 13:58:17,184 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
After some seconds processing starts again.
In contrast, if you comment out the ORDER BY in the Customer Service, the time difference between database exec time and java app exec time is minimal (the problem disappears).
And if you execute one of the above "generated" statements with the following method the problem DOES NOT occur even with the ORDER BY.
public Collection<Customer> getOrderCustomersWithSpring3() {
Collection<Customer> customers = null;
customers = (Collection<Customer>) getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
Collection<Customer> customers = session.createSQLQuery("...").
addEntity(Customer.class).list();
return customers;
}
});
return customers;
}
Also, if you have a table with only 100.000 records the ORDER BY problem does not occur. This seems to be one of the big problems.
Of course, the statement processing time is less when querying 1.000 records out of 100.000 but the halt in the processing in hibernate when it comes to larger datasets seems to be pretty strange (and wrong) behavior.
Thanks in Advance for checking into this issue!
--
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, 3 months
[Hibernate-JIRA] Created: (ANN-517) EntityMode.DOM4J with just Annotations
by Daniel (JIRA)
EntityMode.DOM4J with just Annotations
--------------------------------------
Key: ANN-517
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-517
Project: Hibernate Annotations
Type: Bug
Components: binder
Versions: 3.1beta3, 3.1beta4, 3.1beta5, 3.1beta6, 3.1beta7, 3.1beta8, 3.1beta9, 3.1.0.Beta10, 3.2.0.cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.1, 3.2.0.ga
Environment: Everywhere
Reporter: Daniel
Short description: The EntityMode.DOM4J cannot be used when using just annotations in business entities. It only works when you create a .hbm.xml mapping file. Bug confirmed by Emmanuel.
Long description: http://forum.hibernate.org/viewtopic.php?p=2335725
--
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, 3 months
[Hibernate-JIRA] Created: (HHH-2346) TableGenerator improvement: set initial value when no record found
by Fabrizio Giustina (JIRA)
TableGenerator improvement: set initial value when no record found
------------------------------------------------------------------
Key: HHH-2346
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2346
Project: Hibernate3
Type: Patch
Components: core
Versions: 3.2.1
Reporter: Fabrizio Giustina
Attachments: TableGenerator-init.diff
org.hibernate.id.TableGenerator is initialized during SchemaExport by creating a table and inserting 0 as initial value.
When this generator is used to retrieve an id it throws an exception if no existing records are available in such table. Although this is an uncommon situation, it would be better to handle an empty table by simply starting from the default value instead of throwing an exception.
My use case for example is the use of dbunit in a test db: after hibernate starts the db is cleaned up (all the existing records removed) and only data needed a specific test are loaded. Hibernate can't work with an empty hibernate_unique_key and so this table must be handled carefully (excluded from cleanup or added to dbunit test data).
TableGenerator can however be easily modified to gracefully handle such situation: the simple patch attached enhances TableGenerator by trying to insert the missing record instead of immediately throw an exception. This can't hurt existing use cases since the table initialization just saves from an IdentifierGenerationException.
Patch has been generated from hibernate trunk, 8 January 2007
--
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, 3 months
[Hibernate-JIRA] Commented: (HHH-298) allow joins in filters
by Shawn Clowater (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-298?page=co... ]
Shawn Clowater commented on HHH-298:
------------------------------------
Is it possible to get this reopened? I have an actual business case other than performance where I would find this VERY worthwhile.
Complete details for this can be found at:
http://forum.hibernate.org/viewtopic.php?t=968935&highlight=
However, the short version is this.
We apply a number of filters dynamically at the entity level. One or more of those filters depend on need to join to a child table which we are accomplishing right now with a subselect.
However, when we started this we realized that additional filter conditions needed to be aware of the filter with the subselect so what we ended up with was different filters that have multiple permutations.
We're getting to a point now where we're adding more and more filters in the upcoming months that handling all of these permutations will quickly become too unmanageable. In fact, we're already to that point. If we could tack on a join condition this would greatly simplify our filters and much rejoicing would occur.
The initial reason for close was 'no time', however, that was a year ago.
> allow joins in filters
> ----------------------
>
> Key: HHH-298
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-298
> Project: Hibernate3
> Type: Improvement
> Components: core
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
>
>
> For the sake of performance with complex filters, it'd be nice to allow users to specify joins fragments to be added to the filter tags. Somthing like:
> <filter name="myFilter">
> <filter-join table="MyPermissionTable">
> <condition>
> {this}.id =
> {MyPermissionTable}.object_id
> </condition>
> </filter-join>
> <![CDATA[
> {MyPermissionTable}.user_id =
> :userId
> AND
> {MyPermissionTable}.perm_flg <
> :userPermLevel
> ]]>
> </filter>
--
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, 3 months