-->
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.  [ 4 posts ] 
Author Message
 Post subject: Bad identifier type: net.sf.hibernate.type.ComponentType
PostPosted: Thu Feb 17, 2005 1:32 pm 
Newbie

Joined: Wed Feb 02, 2005 4:02 pm
Posts: 5
New to Hibernate. Working on a sample. I am getting "net.sf.hibernate.MappingException: Bad identifier type: net.sf.hibernate.type.ComponentType" - error. I tried my best to find out from this forum to resolve it but not succeeded. The mapping files are generated through Hibernate tools

Please help me. The details are as follows:

Hibernate version:2.1.8

Hibernate Tools: org.hibernate.eclipse_3.0.0.alpha plugin for eclipse

Config document: 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">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1531:ods1</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.password">u277956</property>
<property name="hibernate.connection.username">u277956</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.default_schema">U277956</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<mapping resource="com/ual/Flights.hbm.xml" />
<mapping resource="com/ual/Reservations.hbm.xml" />
<mapping resource="com/ual/Persons.hbm.xml" />
</session-factory>
</hibernate-configuration>

Mapping documents: Flights.hbm.xml
<?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>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.ual.Flights" table="FLIGHTS" schema="U277956">
<id name="flightId" type="java.math.BigDecimal">
<column name="FLIGHT_ID" length="8" not-null="true" unique="true" sql-type="NUMBER" />
<generator class="assigned" />
</id>
<property name="name" type="java.lang.String">
<column name="NAME" length="32" not-null="true" sql-type="VARCHAR2" />
</property>
<property name="departureUtc" type="java.util.Date">
<column name="DEPARTURE_UTC" length="7" not-null="true" sql-type="DATE" />
</property>
<property name="arrivalUtc" type="java.util.Date">
<column name="ARRIVAL_UTC" length="7" not-null="true" sql-type="DATE" />
</property>
<set name="setOfReservations">
<key>
<column name="FLIGHT_ID" length="8" not-null="false" />
</key>
<one-to-many class="com.ual.Reservations" />
</set>
</class>
</hibernate-mapping>

Mapping documents: Persons.hbm.xml
<?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>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.ual.Persons" table="PERSONS" schema="U277956">
<id name="personId" type="java.math.BigDecimal">
<column name="PERSON_ID" length="8" not-null="true" unique="true" sql-type="NUMBER" />
<generator class="assigned" />
</id>
<property name="firstName" type="java.lang.String">
<column name="FIRST_NAME" length="32" not-null="true" sql-type="VARCHAR2" />
</property>
<property name="lastName" type="java.lang.String">
<column name="LAST_NAME" length="32" not-null="true" sql-type="VARCHAR2" />
</property>
<set name="setOfReservations">
<key>
<column name="PERSON_ID" length="8" not-null="false" />
</key>
<one-to-many class="com.ual.Reservations" />
</set>
</class>
</hibernate-mapping>

Mapping documents: Reservations.hbm.xml
<?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>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.ual.Reservations" table="RESERVATIONS" schema="U277956">
<composite-id name="id" class="com.ual.ReservationsId">
<key-many-to-one name="flights" class="com.ual.Flights">
<column name="FLIGHT_ID" length="8" not-null="false" />
</key-many-to-one>
<key-many-to-one name="persons" class="com.ual.Persons">
<column name="PERSON_ID" length="8" not-null="false" />
</key-many-to-one>
<key-property name="reservationId" type="java.math.BigDecimal">
<column name="RESERVATION_ID" length="8" not-null="true" sql-type="NUMBER" />
</key-property>
</composite-id>
<property name="registrationUtc" type="java.util.Date">
<column name="REGISTRATION_UTC" length="7" not-null="true" sql-type="DATE" />
</property>
<property name="commentary" type="java.lang.String">
<column name="COMMENTARY" length="200" not-null="false" sql-type="VARCHAR2" />
</property>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
public static void main(String[] args) throws Exception {

final MyTest myTest = new MyTest();

Configuration cfg = new Configuration();
cfg.configure("/hibernate.cfg.xml");

myTest.factory = cfg.buildSessionFactory();

System.out.println("Getting all Names");
//myTest.viewAllNames();

myTest.factory.close();

}

Full stack trace of any exception that occurs:
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
net.sf.hibernate.MappingException: Bad identifier type: net.sf.hibernate.type.ComponentType
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:669)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:690)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at MyTest.main(MyTest.java:61)
Exception in thread "main"

Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 17, 2005 9:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The eclipse tools are design for Hibernate 3.x and will not work at all for Hibernate 2.x . You need to get the correct toolset to match the version of hibernate that you are using.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 12:37 pm 
Newbie

Joined: Wed Feb 02, 2005 4:02 pm
Posts: 5
I installed Hibernate 3.0 beta 4. It is working fine now. Thank you for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 1:30 pm 
Newbie

Joined: Wed Aug 09, 2006 1:22 pm
Posts: 1
Location: Calgary AB
This also occurs when you mistakenly use the 3.0 DTD in the hbm.xml files with hibernate2


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.