I seem to be having a problem with the <discriminator> element. It
works when the discriminator's type is "string," but not when it is
"integer." My mapping file looks like this:
<class name="Foo" table="Foo">
<id name="accessionId" column="fooId">
<generator class="assigned" />
</id>
<discriminator column="fooType" type="integer" />
<subclass name="FooA" discriminator-value="1">
<property name="a" />
</subclass>
<subclass name="FooB" discriminator-value="2">
<property name="b" />
</subclass>
<subclass name="FooC" discriminator-value="3">
<property name="c" />
</subclass>
</class>
And I'm getting the following error:
Sep 1, 2002 1:42:39 PM cirrus.hibernate.helpers.XMLHelper parseInputSource
INFO: Parsing XML: unknown system id
Sep 1, 2002 1:42:39 PM cirrus.hibernate.Environment <clinit>
INFO: loaded properties from resource hibernate.properties
Sep 1, 2002 1:42:39 PM cirrus.hibernate.Environment <clinit>
INFO: echoing all SQL to stdout
Sep 1, 2002 1:42:39 PM cirrus.hibernate.Environment <clinit>
INFO: using java.io streams to persist binary types
Sep 1, 2002 1:42:39 PM cirrus.hibernate.Environment <clinit>
INFO: JVM proxy support: true
Sep 1, 2002 1:42:39 PM cirrus.hibernate.sql.Dialect <init>
INFO: Using dialect: class cirrus.hibernate.sql.OracleDialect
Sep 1, 2002 1:42:39 PM
cirrus.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 5
Sep 1, 2002 1:42:39 PM
cirrus.hibernate.connection.DriverManagerConnectionProvider configure
INFO: JDBC isolation level: 2
Sep 1, 2002 1:42:39 PM
cirrus.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using driver: oracle.jdbc.driver.OracleDriver at URL:
jdbc:oracle:thin:@localhost:1521:DEV
Sep 1, 2002 1:42:39 PM
cirrus.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Connection properties: {user=woon, password=foo}
Sep 1, 2002 1:42:39 PM cirrus.hibernate.ps.PreparedStatementCache <init>
INFO: prepared statement cache size: 100
Sep 1, 2002 1:42:39 PM cirrus.hibernate.impl.SessionFactoryImpl <init>
INFO: Use outer join fetching: true
Sep 1, 2002 1:42:40 PM cirrus.hibernate.impl.SessionFactoryImpl <init>
INFO: Use scrollable result sets: true
Sep 1, 2002 1:42:40 PM cirrus.hibernate.impl.SessionFactoryImpl <init>
INFO: Use JDBC 2 batch updates: true
--> cirrus.hibernate.MappingException
--> Could not format discriminator value to SQL string: For input
string: "Foo"
cirrus.hibernate.MappingException: Could not format discriminator value
to SQL string: For input str
ing: "Foo"
at
cirrus.hibernate.impl.ClassPersister.<init>(ClassPersister.java:304)
at
cirrus.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:162)
at
cirrus.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:92)
at
cirrus.hibernate.impl.DatastoreImpl.buildSessionFactory(DatastoreImpl.java:60)
at test.Hibernate.main(Hibernate.java:32)
When I change the discriminator type to a string, however, this will
work perfectly fine... This is with the latest CVS build. Anyone else
seeing this?
Thanks,
-Mark
|