-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: I think there is a BUG :-/
PostPosted: Wed Jun 29, 2005 4:59 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
Hibernate version: 3.0.5

Name and version of the database you are using: Oracle8i (8.1.7.0)

Mapping documents: Just a simple version of UnionSubClass-Unittest

Being.hbm.xml
Code:
<hibernate-mapping default-access="field">
   <class name="persistent.Being" abstract="true">
   
   <id name="id" unsaved-value="0" column="ID">
      <generator class="increment"/>
   </id>
      
   <property name="identity" not-null="true" column="ident"/>
      
   <set name="friends" table="BEINGS_FRIENDS">
      <key column="beingID"/>
      <many-to-many column="ID" class="persistent.Being"/>
   </set>
      
   </class>
</hibernate-mapping>


Alien.hbm.xml
Code:
<hibernate-mapping default-access="field">

   <union-subclass name="persistent.Alien" extends="persistent.Being" table="ALIEN">
      <property name="species" not-null="true" update="false"/>
   </union-subclass>

</hibernate-mapping>


Human.hbm.xml
Code:
<hibernate-mapping default-access="field">
   
   <union-subclass name="persistent.Human" extends="persistent.Being" table="HUMAN">
      <property name="sex" not-null="true" update="false"/>
   </union-subclass>

</hibernate-mapping>

Mapped classes:

Being.java
Code:
public abstract class Being {

   private Long id;
   private String identity;
   
   private Set friends = new HashSet();

   // setter and getter
}


Alien.java
Code:
public class Alien extends Being {

   private String species;
   
   // setter and getter
}


Human.java
Code:
public class Human extends Being {

   private char sex;
   
   // setter and getter
}



Code between sessionFactory.openSession() and session.close():

Code:
Human h1 = new Human();
h1.setIdentity("alex");
h1.setSex('M');
         
Human h2 = new Human();
h2. setIdentity("judith");
h2.setSex('F');
         
Alien a1 = new Alien();
a1.setIdentity("c3po");
a1.setSpecies("Translator");
         
Alien a2 = new Alien();
a2.setIdentity("R2");
a2.setSpecies("Fighter");
         
h1.addFriend(h2);
h1.addFriend(a1);
         
s.save(a1);
s.save(a2);
s.save(h2);
s.save(h1);
         
tx.commit();

tx = s.beginTransaction();
Query q = s.createQuery("FROM Being");
List l = q.list();
         
Iterator i = l.iterator();
while (i.hasNext()) {
   Being b = (Being)i.next();
   System.out.println("Being: " + b.getIdentity());
}
tx.commit();


Very, very simple ;-) After runnig that code everthing works fine and the generated sql query is shown below.

The generated SQL:
Code:
select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_



Ok! Now the problem. Change the class Human.java the follwing way.
(change char sex to int sex)
Code:
public class Human extends Being {

   private int sex;
   
   // setter and getter
}


Now delete database schema and run the example again. What you get is:

WARN - SQL Error: 1790, SQLState: 42000
ERROR - ORA-01790:

The generated SQL:
Code:
select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_


Mhhh...the SQL query seems to be the same, but it doesnt work (in my case). I also tried it with MySQL database and both samples worked?!?!. Is there something I misunderstood?!?! My question is now....what the hell should I do to make it work with Oracle. I have a legacy db so the schema and the database are fixed. (Thats why I am using <union-subclass>. Inheritance and Polymorphism are fundamental in OO so it MUST work with Hibernate and Oracle. Please help me!! Otherwise its a disaster :-/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you dont show the stacktrace...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:39 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
INFO - Hibernate 3.0.5
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - using JDK 1.4 java.sql.Timestamp handling
INFO - Mapping resource: persistent/Being.hbm.xml
INFO - Mapping class: persistent.Being -> Being
INFO - Mapping collection: persistent.Being.friends -> BEINGS_FRIENDS
INFO - Mapping resource: persistent/Human.hbm.xml
INFO - Mapping union-subclass: persistent.Human -> HUMAN
INFO - Mapping resource: persistent/Alien.hbm.xml
INFO - Mapping union-subclass: persistent.Alien -> ALIEN
INFO - processing extends queue
INFO - processing collection mappings
INFO - processing association property references
INFO - processing foreign key constraints
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - autocommit mode: false
INFO - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - connection properties: {user=scott, password=****}
INFO - RDBMS: Oracle, version: Oracle8i Release 8.1.7.0.0 - Production
JServer Release 8.1.7.0.0 - Production
INFO - JDBC driver: Oracle JDBC driver, version: 9.2.0.5.0
INFO - Using dialect: org.hibernate.dialect.Oracle9Dialect
INFO - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - Automatic flush during beforeCompletion(): disabled
INFO - Automatic session close at end of transaction: disabled
INFO - JDBC batch size: 15
INFO - JDBC batch updates for versioned data: disabled
INFO - Scrollable result sets: enabled
INFO - JDBC3 getGeneratedKeys(): disabled
INFO - Connection release mode: null
INFO - Default batch fetch size: 1
INFO - Generate SQL with comments: disabled
INFO - Order SQL updates by primary key: disabled
INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - Using ASTQueryTranslatorFactory
INFO - Query language substitutions: {}
INFO - Second-level cache: enabled
INFO - Query cache: disabled
INFO - Cache provider: org.hibernate.cache.HashtableCacheProvider
INFO - Optimize cache for minimal puts: disabled
INFO - Structured second-level cache entries: disabled
INFO - Echoing all SQL to stdout
INFO - Statistics: disabled
INFO - Deleted entity synthetic identifier rollback: disabled
INFO - Default entity-mode: pojo
INFO - building session factory
INFO - Not binding factory to JNDI, no JNDI name configured
INFO - Using dialect: org.hibernate.dialect.Oracle9Dialect
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - autocommit mode: false
INFO - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - connection properties: {user=scott, password=****}
INFO - Running hbm2ddl schema update
INFO - fetching database metadata
INFO - updating schema
INFO - processing extends queue
INFO - processing collection mappings
INFO - processing association property references
INFO - processing foreign key constraints
INFO - table not found: ALIEN
INFO - table not found: BEINGS_FRIENDS
INFO - table not found: HUMAN
INFO - table not found: ALIEN
INFO - table not found: BEINGS_FRIENDS
INFO - table not found: HUMAN
INFO - schema update complete
INFO - cleaning up connection pool: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - Checking 0 named queries
Hibernate: insert into ALIEN (ident, species, ID) values (?, ?, ?)
Hibernate: insert into ALIEN (ident, species, ID) values (?, ?, ?)
Hibernate: insert into HUMAN (ident, sex, ID) values (?, ?, ?)
Hibernate: insert into HUMAN (ident, sex, ID) values (?, ?, ?)
Hibernate: insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
Hibernate: insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
INFO - cleaning up connection pool: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
Hibernate: select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_
WARN - SQL Error: 1790, SQLState: 42000
ERROR - ORA-01790: Ausdruck muss denselben Datentyp wie der korrespondierende Ausdruck aufweisen

Do you mean that?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are still only showing the top of the stacktrace! where is the rest ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:44 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
well..there is no rest?

please dont think I am a moron, but how do I get more?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:55 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
I changed INFO to DEBUG in the Log4J properties now I got more...

INFO - Hibernate 3.0.5
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - using JDK 1.4 java.sql.Timestamp handling
INFO - Mapping resource: persistent/Being.hbm.xml
DEBUG - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
DEBUG - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
INFO - Mapping class: persistent.Being -> Being
DEBUG - Mapped property: id -> ID
DEBUG - Mapped property: identity -> ident
INFO - Mapping collection: persistent.Being.friends -> BEINGS_FRIENDS
DEBUG - Mapped property: friends
INFO - Mapping resource: persistent/Human.hbm.xml
DEBUG - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
DEBUG - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
INFO - Mapping union-subclass: persistent.Human -> HUMAN
DEBUG - Mapped property: sex -> sex
INFO - Mapping resource: persistent/Alien.hbm.xml
DEBUG - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
DEBUG - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
INFO - Mapping union-subclass: persistent.Alien -> ALIEN
DEBUG - Mapped property: species -> species
DEBUG - Preparing to build session factory with filters : {}
INFO - processing extends queue
INFO - processing collection mappings
DEBUG - Second pass for collection: persistent.Being.friends
DEBUG - Mapped collection key: beingID, element: ID
INFO - processing association property references
INFO - processing foreign key constraints
DEBUG - resolving reference to class: persistent.Being
DEBUG - resolving reference to class: persistent.Being
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - autocommit mode: false
INFO - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - connection properties: {user=scott, password=tiger}
DEBUG - total checked-out connections: 0
DEBUG - opening new JDBC connection
DEBUG - created connection to: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE, Isolation Level: 2
DEBUG - could not get database version from JDBC metadata
INFO - RDBMS: Oracle, version: Oracle8i Release 8.1.7.0.0 - Production
JServer Release 8.1.7.0.0 - Production
INFO - JDBC driver: Oracle JDBC driver, version: 9.2.0.5.0
DEBUG - returning connection to pool, pool size: 1
INFO - Using dialect: org.hibernate.dialect.Oracle9Dialect
INFO - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - Automatic flush during beforeCompletion(): disabled
INFO - Automatic session close at end of transaction: disabled
INFO - JDBC batch size: 15
INFO - JDBC batch updates for versioned data: disabled
INFO - Scrollable result sets: enabled
DEBUG - Wrap result sets: disabled
INFO - JDBC3 getGeneratedKeys(): disabled
INFO - Connection release mode: null
INFO - Default batch fetch size: 1
INFO - Generate SQL with comments: disabled
INFO - Order SQL updates by primary key: disabled
INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - Using ASTQueryTranslatorFactory
INFO - Query language substitutions: {}
INFO - Second-level cache: enabled
INFO - Query cache: disabled
INFO - Cache provider: org.hibernate.cache.HashtableCacheProvider
INFO - Optimize cache for minimal puts: disabled
INFO - Structured second-level cache entries: disabled
DEBUG - Using dialect defined converter
INFO - Echoing all SQL to stdout
INFO - Statistics: disabled
INFO - Deleted entity synthetic identifier rollback: disabled
INFO - Default entity-mode: pojo
INFO - building session factory
DEBUG - Session factory constructed with filter configurations : {}
DEBUG - instantiating session factory with properties: {hibernate.connection.password=tiger, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\j2sdk1.4.2_06\jre\bin, java.vm.version=1.4.2_06-b03, hibernate.connection.username=scott, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=DE, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Inheritance, java.runtime.version=1.4.2_06-b03, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\j2sdk1.4.2_06\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\TriA\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.java2d.fontpath=, java.library.path=C:\j2sdk1.4.2_06\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\Programme\Javasoft\Jre\1.3.1\BIN;C:\Programme\Javasoft\Jre\1.3.1\BIN\hotspot;C:\Utils\Oracle\bin;C:\Programme\Oracle\jre\1.3.1\bin;C:\Programme\Oracle\jre\1.1.8\bin;C:\j2sdk1.4.2_06\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\ULTRAE~1;C:\Programme\Rational\common;C:\Programme\Symantec\pcAnywhere\;C:\Sun\AppServer\bin, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=C:\Dokumente und Einstellungen\TriA, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, user.name=tria, java.class.path=G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Inheritance\bin;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\mysql-connector-java-3.1.8\mysql-connector-java-3.1.8-bin.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\oracle-connector-java\ojdbc14_9.2.0.5.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\hibernate3.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\log4j-1.2.9.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\antlr-2.7.5H3.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\asm.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\cglib-2.1.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\commons-collections-2.1.1.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\commons-logging-1.0.4.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\dom4j-1.6.jar;G:\85944000_Gebaeudeautomation\Visualisierung\Workspaces\WorkspaceHibernate\Libs\hibernate-3.0.5\lib\jta.jar, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\j2sdk1.4.2_06\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.connection.url=jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE, user.language=de, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_06, java.ext.dirs=C:\j2sdk1.4.2_06\jre\lib\ext, sun.boot.class.path=C:\j2sdk1.4.2_06\jre\lib\rt.jar;C:\j2sdk1.4.2_06\jre\lib\i18n.jar;C:\j2sdk1.4.2_06\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_06\jre\lib\jsse.jar;C:\j2sdk1.4.2_06\jre\lib\jce.jar;C:\j2sdk1.4.2_06\jre\lib\charsets.jar;C:\j2sdk1.4.2_06\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, hibernate.hbm2ddl.auto=update, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
DEBUG - Static SQL for entity: persistent.Human
DEBUG - Version select: select ID from HUMAN where ID =?
DEBUG - Snapshot select: select human_.ID, human_.ident as ident0_ from HUMAN human_ where human_.ID=?
DEBUG - Insert 0: insert into HUMAN (ident, sex, ID) values (?, ?, ?)
DEBUG - Update 0: update HUMAN set ident=? where ID=?
DEBUG - Delete 0: delete from HUMAN where ID=?
DEBUG - Static SQL for entity: persistent.Alien
DEBUG - Version select: select ID from ALIEN where ID =?
DEBUG - Snapshot select: select alien_.ID, alien_.ident as ident0_ from ALIEN alien_ where alien_.ID=?
DEBUG - Insert 0: insert into ALIEN (ident, species, ID) values (?, ?, ?)
DEBUG - Update 0: update ALIEN set ident=? where ID=?
DEBUG - Delete 0: delete from ALIEN where ID=?
DEBUG - Static SQL for entity: persistent.Being
DEBUG - Version select: select ID from Being where ID =?
DEBUG - Snapshot select: select being_.ID, being_.ident as ident0_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being_ where being_.ID=?
DEBUG - Insert 0: insert into Being (ident, ID) values (?, ?)
DEBUG - Update 0: update Being set ident=? where ID=?
DEBUG - Delete 0: delete from Being where ID=?
DEBUG - Static SQL for collection: persistent.Being.friends
DEBUG - Row insert: insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
DEBUG - Row update: update BEINGS_FRIENDS set ID=? where beingID=? and ID=?
DEBUG - Row delete: delete from BEINGS_FRIENDS where beingID=? and ID=?
DEBUG - One-shot delete: delete from BEINGS_FRIENDS where beingID=?
DEBUG - Static select for entity persistent.Human: select human0_.ID as ID0_, human0_.ident as ident0_0_, human0_.sex as sex2_0_ from HUMAN human0_ where human0_.ID=?
DEBUG - Static select for entity persistent.Human: select human0_.ID as ID0_, human0_.ident as ident0_0_, human0_.sex as sex2_0_ from HUMAN human0_ where human0_.ID=?
DEBUG - Static select for entity persistent.Human: select human0_.ID as ID0_, human0_.ident as ident0_0_, human0_.sex as sex2_0_ from HUMAN human0_ where human0_.ID=? for update
DEBUG - Static select for entity persistent.Human: select human0_.ID as ID0_, human0_.ident as ident0_0_, human0_.sex as sex2_0_ from HUMAN human0_ where human0_.ID=? for update nowait
DEBUG - Static select for entity persistent.Being: select being0_.ID as ID0_, being0_.ident as ident0_0_, being0_.sex as sex2_0_, being0_.species as species3_0_, being0_.clazz_ as clazz_0_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_ where being0_.ID=?
DEBUG - Static select for entity persistent.Being: select being0_.ID as ID0_, being0_.ident as ident0_0_, being0_.sex as sex2_0_, being0_.species as species3_0_, being0_.clazz_ as clazz_0_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_ where being0_.ID=?
DEBUG - Static select for entity persistent.Being: select being0_.ID as ID0_, being0_.ident as ident0_0_, being0_.sex as sex2_0_, being0_.species as species3_0_, being0_.clazz_ as clazz_0_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_ where being0_.ID=? for update
DEBUG - Static select for entity persistent.Being: select being0_.ID as ID0_, being0_.ident as ident0_0_, being0_.sex as sex2_0_, being0_.species as species3_0_, being0_.clazz_ as clazz_0_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_ where being0_.ID=? for update nowait
DEBUG - Static select for entity persistent.Alien: select alien0_.ID as ID0_, alien0_.ident as ident0_0_, alien0_.species as species3_0_ from ALIEN alien0_ where alien0_.ID=?
DEBUG - Static select for entity persistent.Alien: select alien0_.ID as ID0_, alien0_.ident as ident0_0_, alien0_.species as species3_0_ from ALIEN alien0_ where alien0_.ID=?
DEBUG - Static select for entity persistent.Alien: select alien0_.ID as ID0_, alien0_.ident as ident0_0_, alien0_.species as species3_0_ from ALIEN alien0_ where alien0_.ID=? for update
DEBUG - Static select for entity persistent.Alien: select alien0_.ID as ID0_, alien0_.ident as ident0_0_, alien0_.species as species3_0_ from ALIEN alien0_ where alien0_.ID=? for update nowait
DEBUG - Static select for collection persistent.Being.friends: select friends0_.beingID as beingID1_, friends0_.ID as ID1_, being1_.ID as ID0_, being1_.ident as ident0_0_, being1_.sex as sex2_0_, being1_.species as species3_0_, being1_.clazz_ as clazz_0_ from BEINGS_FRIENDS friends0_ inner join ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being1_ on friends0_.ID=being1_.ID where friends0_.beingID=?
DEBUG - initializing class SessionFactoryObjectFactory
DEBUG - registered: 4028413404c7baf20104c7baf5c30000 (unnamed)
INFO - Not binding factory to JNDI, no JNDI name configured
DEBUG - instantiated session factory
INFO - Using dialect: org.hibernate.dialect.Oracle9Dialect
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - autocommit mode: false
INFO - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - connection properties: {user=scott, password=tiger}
INFO - Running hbm2ddl schema update
INFO - fetching database metadata
DEBUG - total checked-out connections: 0
DEBUG - opening new JDBC connection
DEBUG - created connection to: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE, Isolation Level: 2
INFO - updating schema
INFO - processing extends queue
INFO - processing collection mappings
INFO - processing association property references
INFO - processing foreign key constraints
DEBUG - resolving reference to class: persistent.Being
DEBUG - resolving reference to class: persistent.Being
INFO - table not found: ALIEN
INFO - table not found: BEINGS_FRIENDS
INFO - table not found: HUMAN
INFO - table not found: ALIEN
INFO - table not found: BEINGS_FRIENDS
INFO - table not found: HUMAN
DEBUG - create table ALIEN (ID number(19,0) not null, ident varchar2(255) not null, species varchar2(255) not null, primary key (ID))
DEBUG - create table BEINGS_FRIENDS (beingID number(19,0) not null, ID number(19,0) not null, primary key (beingID, ID))
DEBUG - create table HUMAN (ID number(19,0) not null, ident varchar2(255) not null, sex number(10,0) not null, primary key (ID))
INFO - schema update complete
INFO - cleaning up connection pool: jdbc:oracle:thin:@ZPOINTCSDEMOTRI:1521:ARCHIVE
INFO - Checking 0 named queries
DEBUG - opened session at timestamp: 4587693735878656
DEBUG - begin
DEBUG - opening JDBC connection
DEBUG - total checked-out connections: 0
DEBUG - using pooled JDBC connection, pool size: 0
DEBUG - current autocommit status: false
DEBUG - saving transient instance
DEBUG - fetching initial value: select max(ids_.ID) from ( select ID from ALIEN union select ID from HUMAN ) ids_
DEBUG - select max(ids_.ID) from ( select ID from ALIEN union select ID from HUMAN ) ids_
DEBUG - first free id: 1
DEBUG - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
DEBUG - saving [persistent.Alien#1]
DEBUG - Wrapped collection in role: persistent.Being.friends
DEBUG - saving transient instance
DEBUG - generated identifier: 2, using strategy: org.hibernate.id.IncrementGenerator
DEBUG - saving [persistent.Alien#2]
DEBUG - Wrapped collection in role: persistent.Being.friends
DEBUG - saving transient instance
DEBUG - generated identifier: 3, using strategy: org.hibernate.id.IncrementGenerator
DEBUG - saving [persistent.Human#3]
DEBUG - Wrapped collection in role: persistent.Being.friends
DEBUG - saving transient instance
DEBUG - generated identifier: 4, using strategy: org.hibernate.id.IncrementGenerator
DEBUG - saving [persistent.Human#4]
DEBUG - Wrapped collection in role: persistent.Being.friends
DEBUG - commit
DEBUG - automatically flushing session
DEBUG - flushing session
DEBUG - processing flush-time cascades
DEBUG - dirty checking collections
DEBUG - Flushing entities and processing referenced collections
DEBUG - Collection found: [persistent.Being.friends#1], was: [<unreferenced>] (initialized)
DEBUG - Collection found: [persistent.Being.friends#2], was: [<unreferenced>] (initialized)
DEBUG - Collection found: [persistent.Being.friends#3], was: [<unreferenced>] (initialized)
DEBUG - Collection found: [persistent.Being.friends#4], was: [<unreferenced>] (initialized)
DEBUG - Processing unreferenced collections
DEBUG - Scheduling collection removes/(re)creates/updates
DEBUG - Flushed: 4 insertions, 0 updates, 0 deletions to 4 objects
DEBUG - Flushed: 4 (re)creations, 0 updates, 0 removals to 4 collections
DEBUG - listing entities:
DEBUG - persistent.Alien{identity=R2, friends=[], id=2, species=Fighter}
DEBUG - persistent.Human{sex=0, identity=judith, friends=[], id=3}
DEBUG - persistent.Human{sex=1, identity=alex, friends=[persistent.Being#1, persistent.Being#3], id=4}
DEBUG - persistent.Alien{identity=c3po, friends=[], id=1, species=Translator}
DEBUG - executing flush
DEBUG - Inserting entity: [persistent.Alien#1]
DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - insert into ALIEN (ident, species, ID) values (?, ?, ?)
Hibernate: insert into ALIEN (ident, species, ID) values (?, ?, ?)
DEBUG - preparing statement
DEBUG - Dehydrating entity: [persistent.Alien#1]
DEBUG - binding 'c3po' to parameter: 1
DEBUG - binding 'Translator' to parameter: 2
DEBUG - binding '1' to parameter: 3
DEBUG - Adding to batch
DEBUG - Inserting entity: [persistent.Alien#2]
DEBUG - reusing prepared statement
DEBUG - insert into ALIEN (ident, species, ID) values (?, ?, ?)
Hibernate: insert into ALIEN (ident, species, ID) values (?, ?, ?)
DEBUG - Dehydrating entity: [persistent.Alien#2]
DEBUG - binding 'R2' to parameter: 1
DEBUG - binding 'Fighter' to parameter: 2
DEBUG - binding '2' to parameter: 3
DEBUG - Adding to batch
DEBUG - Inserting entity: [persistent.Human#3]
DEBUG - Executing batch size: 2
DEBUG - success of batch update unknown: 0
DEBUG - success of batch update unknown: 1
DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - closing statement
DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - insert into HUMAN (ident, sex, ID) values (?, ?, ?)
Hibernate: insert into HUMAN (ident, sex, ID) values (?, ?, ?)
DEBUG - preparing statement
DEBUG - Dehydrating entity: [persistent.Human#3]
DEBUG - binding 'judith' to parameter: 1
DEBUG - binding '0' to parameter: 2
DEBUG - binding '3' to parameter: 3
DEBUG - Adding to batch
DEBUG - Inserting entity: [persistent.Human#4]
DEBUG - reusing prepared statement
DEBUG - insert into HUMAN (ident, sex, ID) values (?, ?, ?)
Hibernate: insert into HUMAN (ident, sex, ID) values (?, ?, ?)
DEBUG - Dehydrating entity: [persistent.Human#4]
DEBUG - binding 'alex' to parameter: 1
DEBUG - binding '1' to parameter: 2
DEBUG - binding '4' to parameter: 3
DEBUG - Adding to batch
DEBUG - Executing batch size: 2
DEBUG - success of batch update unknown: 0
DEBUG - success of batch update unknown: 1
DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - closing statement
DEBUG - Inserting collection: [persistent.Being.friends#1]
DEBUG - collection was empty
DEBUG - Inserting collection: [persistent.Being.friends#2]
DEBUG - collection was empty
DEBUG - Inserting collection: [persistent.Being.friends#3]
DEBUG - collection was empty
DEBUG - Inserting collection: [persistent.Being.friends#4]
DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
Hibernate: insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
DEBUG - preparing statement
DEBUG - binding '4' to parameter: 1
DEBUG - binding '1' to parameter: 2
DEBUG - Adding to batch
DEBUG - reusing prepared statement
DEBUG - insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
Hibernate: insert into BEINGS_FRIENDS (beingID, ID) values (?, ?)
DEBUG - binding '4' to parameter: 1
DEBUG - binding '3' to parameter: 2
DEBUG - Adding to batch
DEBUG - done inserting collection: 2 rows inserted
DEBUG - Executing batch size: 2
DEBUG - success of batch update unknown: 0
DEBUG - success of batch update unknown: 1
DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - closing statement
DEBUG - post flush
DEBUG - before transaction completion
DEBUG - before transaction completion
DEBUG - committed JDBC Connection
DEBUG - after transaction completion
DEBUG - after transaction completion
DEBUG - find: FROM Being
DEBUG - named parameters: {}
DEBUG - parse() - HQL: FROM persistent.Being
DEBUG - --- HQL AST ---
\-[QUERY] 'query'
\-[SELECT_FROM] 'SELECT_FROM'
\-[FROM] 'FROM'
\-[RANGE] 'RANGE'
\-[DOT] '.'
+-[IDENT] 'persistent'
\-[IDENT] 'Being'

DEBUG - throwQueryException() : no errors
DEBUG - query() << begin, level = 1
DEBUG - FromClause{level=1} : persistent.Being (no alias) -> being0_
DEBUG - query() : finishing up , level = 1
DEBUG - processQuery() : ( SELECT ( FromClause{level=1} ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_ ) )
DEBUG - Derived SELECT clause created.
DEBUG - Using FROM fragment [( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_]
DEBUG - query() >> end, level = 1
DEBUG - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (Being,ALIEN,HUMAN)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'being0_.ID as ID' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ),tableAlias=being0_,colums={,className=persistent.Being}}}
| \-[SQL_TOKEN] SqlFragment: 'being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_'
\-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[being0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
\-[FROM_FRAGMENT] FromElement: '( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ),tableAlias=being0_,colums={,className=persistent.Being}}

DEBUG - throwQueryException() : no errors
DEBUG - HQL: FROM persistent.Being
DEBUG - SQL: select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_
DEBUG - throwQueryException() : no errors
DEBUG - flushing session
DEBUG - processing flush-time cascades
DEBUG - dirty checking collections
DEBUG - Flushing entities and processing referenced collections
DEBUG - Collection found: [persistent.Being.friends#1], was: [persistent.Being.friends#1] (initialized)
DEBUG - Collection found: [persistent.Being.friends#2], was: [persistent.Being.friends#2] (initialized)
DEBUG - Collection found: [persistent.Being.friends#3], was: [persistent.Being.friends#3] (initialized)
DEBUG - Collection found: [persistent.Being.friends#4], was: [persistent.Being.friends#4] (initialized)
DEBUG - Processing unreferenced collections
DEBUG - Scheduling collection removes/(re)creates/updates
DEBUG - Flushed: 0 insertions, 0 updates, 0 deletions to 4 objects
DEBUG - Flushed: 0 (re)creations, 0 updates, 0 removals to 4 collections
DEBUG - listing entities:
DEBUG - persistent.Alien{identity=R2, friends=[], id=2, species=Fighter}
DEBUG - persistent.Human{sex=0, identity=judith, friends=[], id=3}
DEBUG - persistent.Human{sex=1, identity=alex, friends=[persistent.Being#1, persistent.Being#3], id=4}
DEBUG - persistent.Alien{identity=c3po, friends=[], id=1, species=Translator}
DEBUG - Dont need to execute flush
DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_
Hibernate: select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_
DEBUG - preparing statement
DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - closing statement
DEBUG - could not execute query [select being0_.ID as ID, being0_.ident as ident0_, being0_.sex as sex2_, being0_.species as species3_, being0_.clazz_ as clazz_ from ( select sex, ident, ID, null as species, 1 as clazz_ from HUMAN union all select null as sex, ident, ID, species, 2 as clazz_ from ALIEN ) being0_]
java.sql.SQLException: ORA-01790: Ausdruck muss denselben Datentyp wie der korrespondierende Ausdruck aufweisen

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:880)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2516)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:537)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at client.Client.main(Client.java:110)
WARN - SQL Error: 1790, SQLState: 42000
ERROR - ORA-01790: Ausdruck muss denselben Datentyp wie der korrespondierende Ausdruck aufweisen

DEBUG - after autocommit
org.hibernate.exception.GenericJDBCException: could not execute query
DEBUG - rollback
DEBUG - before transaction completion
DEBUG - before transaction completion
DEBUG - rolled back JDBC Connection
DEBUG - after transaction completion
DEBUG - after transaction completion
DEBUG - closing session
DEBUG - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG - returning connection to pool, pool size: 1
DEBUG - after transaction completion
DEBUG - after transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
aint you changing the value to an int and still have the char value in the database!

that gotta give some conversion problem somewhere when loading

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 7:00 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
no the database is empty


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 7:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well read the german error message .... isnt that about non matching types ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 8:43 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
thats another thing I dont understand, but....the database is definitely empty.
I also tried it with other table name (ALIEN2, HUMAN2 ;-) and it also didnt work.

no other idea? :-/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 8:47 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
maybe "int" is converted in a wrong way?

it´s mapped as NUMBER(10) to DB


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 9:31 am 
Newbie

Joined: Wed May 25, 2005 7:24 am
Posts: 11
Location: Austria
Criteria crit = s.createCriteria(Human.class); works

Criteria crit = s.createCriteria(Alien.class); works

Criteria crit = s.createCriteria(Being.class); doesn't work

Query q = s.createQuery("FROM Human"); works

Query q = s.createQuery("FROM Alien"); works

Query q = s.createQuery("FROM Being"); doesn't work


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.