[Hibernate-JIRA] Created: (HHH-2211) A createQuery() caused ORA-00904 error
by sodia (JIRA)
A createQuery() caused ORA-00904 error
--------------------------------------
Key: HHH-2211
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2211
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.2.0.ga
Environment: JDK1.5.0+Eclipse3.2.1+Hibernate3.2.0.ga+Oracle9.2.0+WinXp(Prof)Sp2
Reporter: sodia
Priority: Trivial
Attachments: hiber-grammar-sql-and-errlog.zip, hiber-grammar-test.zip
I want to try the following sql under hibernate,it failed.
(The project is build on the basis of hibernate3.2's tutorial)
String hqlAlias =
"insert into EventHistory ( id, date, title )" +
" select id, date, title from Event e" +
" where e.title like 'BUY%'" +
" and exists" +
" ( select 1 from PersonEvent p" +
" where p.id=e.id)";
int resultAlias = session.createQuery(hqlAlias).executeUpdate();
But it works nice under sqlplus.
INSERT INTO EVENTS_HISTORY
SELECT * FROM EVENTS
WHERE TITLE LIKE 'BUY%'
AND EXISTS
( SELECT 1 FROM PERSON_EVENT
WHERE EVENT_ID=EVENTS.EVENT_ID);
The 4 lines of error log is like this:
15:33:29,906 DEBUG SQL:393 - insert into EVENTS_HISTORY ( EVENT_ID, EVENT_DATE, title ) select event0_.EVENT_ID as col_0_0_, event0_.EVENT_DATE as col_1_0_, event0_.title as col_2_0_ from EVENTS event0_ where (event0_.title like 'BUY%') and (exists (select 1 from PERSON_EVENT personeven1_ where personeven1_.EVENT_ID=EVENTS.EVENT_ID))
Hibernate: insert into EVENTS_HISTORY ( EVENT_ID, EVENT_DATE, title ) select event0_.EVENT_ID as col_0_0_, event0_.EVENT_DATE as col_1_0_, event0_.title as col_2_0_ from EVENTS event0_ where (event0_.title like 'BUY%') and (exists (select 1 from PERSON_EVENT personeven1_ where personeven1_.EVENT_ID=EVENTS.EVENT_ID))
15:33:29,984 WARN JDBCExceptionReporter:71 - SQL Error: 904, SQLState: 42000
15:33:29,984 ERROR JDBCExceptionReporter:72 - ORA-00904: "EVENTS"."EVENT_ID": 无效的??符
Is there any wrong with the hql,or it's alias?
Thanks to anyone who pay attetion to this trivial question which I search the forum and google without solutions.
Or if I missed them,I would be grateful that you might tell me where can I find the right answer to fix this hql grammar error.
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-2110) Proxied object causes ClassCastException when method returns 'this' in a composite hierarchy
by Philip Nightingale (JIRA)
Proxied object causes ClassCastException when method returns 'this' in a composite hierarchy
--------------------------------------------------------------------------------------------
Key: HHH-2110
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2110
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.0.5
Environment: Hibernate 3, any database (test case uses HSQL, issue found using Oracle)
Reporter: Philip Nightingale
Attachments: HibernateClassCastExceptionTest.zip
If a proxied object has a method that returns 'this' and the proxy type extends the same base class as the target object and the return type of the method is the target class type then a ClassCastException is thrown.
The error can be tracked down to the method CGLibLazyInitializer::intercept(Object, Method, Object[], MethodProxy).
In this method, if the object returned from the method call on the target object is the same as the target object, then instead of returning the object itself the proxy is returned. This is fine in most cases, but in the special case described, in which the proxy extends a base class that is also extended by the target class, then the CCE occurs.
In the submitted test case I have a simple composite hierarchy with an abstract base type and two concrete subtypes. Either type can contain children, but only one can be the root of the hierarchy (and cannot itslef be a child). There is a many-to-one relationship defined from the sub-type that may be a child to the base class.
The submitted test case is configured to use Hypersonic DB so hsqldb.jar is required on the classpath.
Further details and code snippets from the original code that caused the exception are posted on the Hibernate user forum (topic "ClassCastException with CGLIB Lazy Initialization")
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-3015) mysql fail generating index for index property on column tag
by Marco Oreste Pogliaghi (JIRA)
mysql fail generating index for index property on column tag
-------------------------------------------------------------
Key: HHH-3015
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3015
Project: Hibernate3
Issue Type: Improvement
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, database mysql 5.0.41
Reporter: Marco Oreste Pogliaghi
Priority: Minor
Having a table definition of this type:
------------------------------------
<hibernate-mapping>
<class name="my.Table" table="mytable">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="native" />
</id>
<property name="code" type="java.lang.String">
<column name="code"
length="6"
unique="true"
index="mytable_code_idx" />
</property>
</hibernate-mapping>
------------------------------
when translating index property for field code, the generated sql for mysql is:
create index mytable_code_idx on mytable(code)
if the user has no full index privilege, this line result in an error:
INDEX command denied to user...
translating the generation of the index as
alter table mytable add index mytable_code_idx (code)
will succed also for user with index privileges only on the table.
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HBX-1025) Hibernate Tools doesn't fetch any table
by pablo (JIRA)
Hibernate Tools doesn't fetch any table
---------------------------------------
Key: HBX-1025
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1025
Project: Hibernate Tools
Issue Type: Bug
Components: reverse-engineer
Affects Versions: 3.2beta9
Environment: Jbuilder 2007, Oracle 10g, Hibernate 3.2, Hibernate tools 3.2 9a
Reporter: pablo
Priority: Blocker
Hi.
I'm developing an Struts application with Hibernate. I use Oracle 10g.
When I run the application, the hibernate plugin connects correctly to the database and maps the entities I configured manually in the hibernate.cfg.xml.
I want to do a reverse eng creating the java dao objects, but when I try to fetch all tables, nothing appears and no error is shown.
If I configure the hibernate tools to generate the html documentation, I get an IndexOutOfBoundException (0,0).
any idea?
<hibernate-configuration>
<session-factory name="factory">
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">iaap</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.58.191:1521:iaap</property>
<property name="hibernate.connection.username">iaap</property>
<property name="hibernate.default_schema">iaap</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-3013) value not necessary is mappingClass but should return ClassType, getTypedValue(Criteria subcriteria, String propertyName, Object value)
by kinfei (JIRA)
value not necessary is mappingClass but should return ClassType, getTypedValue(Criteria subcriteria, String propertyName, Object value)
---------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3013
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3013
Project: Hibernate3
Issue Type: Bug
Environment: 3.2.5, mysql
Reporter: kinfei
Priority: Critical
Criteria criteria = this.createCriteria( Entity.class ).add( Restrictions.eq( "entityClass", Entity.class ) );
--> throw QueryException( "Unsupported discriminator type " + type )
public Entity {
private Class entityClass;
public void setEntityClass( Class entityClass ) {
.....
}
<class name="Entity" table="tbl_entity">
<id
name="id"
column="ENTITY_ID"
type="java.lang.Long"
unsaved-value="-1" >
<generator class="increment" />
</id>
<property
name="entityClass"
column="ENTITY_CLASS"
type="java.lang.Class"
length="50"
not-null="true"
/>
/**
* Get the a typed value for the given property value.
*/
public TypedValue getTypedValue(Criteria subcriteria, String propertyName, Object value)
throws HibernateException {
// Detect discriminator values...
if ( value instanceof Class ) {
Class entityClass = ( Class ) value;
Queryable q = SessionFactoryHelper.findQueryableUsingImports( sessionFactory, entityClass.getName() ); //=====>return mapping class
if ( q != null ) {
Type type = q.getDiscriminatorType();
String stringValue = q.getDiscriminatorSQLValue();
// Convert the string value into the proper type.
if ( type instanceof NullableType ) {
NullableType nullableType = ( NullableType ) type;
value = nullableType.fromStringValue( stringValue );
}
else {
throw new QueryException( "Unsupported discriminator type " + type );
}
--
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
18 years, 4 months