BigDecimalType is not handled in IdentifierGeneratorFactory

Description

xmlorg.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:78)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)

Environment

Oracle 8.1.7/Linux|Windows, ojdbc14.jar

Activity

Show:
Gabor Kincses
May 1, 2006, 9:55 PM

Ok, I can do that. But it seems that if long, integer, short or string are supported, then java.math.BigDecimal should probably be supported out of the box. Seems like default Oracle behavior. Or support ends at java.lang?

Emmanuel Bernard
May 3, 2006, 8:16 PM

I actually have hard time understanding why a BigDecimal is useful for a generated primary key

Gabor Kincses
May 3, 2006, 9:11 PM

Little more background: I have a very large schema (>1000 tables) that I have reverse engineered using hibernate tools. In the table `FOO' the primary key is the column `ID', which generated this mapping:
<class name="org.bar.Foo" table="FOO">
<id name="id" type="big_decimal">
<column name="ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
...
</class>
Since the underlying database uses oracle sequences I have replaced the generator directive with:
<class name="org.bar.Foo" table="FOO">
<id name="id" type="big_decimal">
<column name="ID" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">FOO_SEQ</param>
</generator>
</id>
...
</class>
Then I get the above error when trying to insert a new-new object. What gives?

Max Rydahl Andersen
May 3, 2006, 9:20 PM

so you should either use another keygenerator or another type for the id.

Steve Ebersole
March 21, 2011, 7:04 PM

Bulk closing stale resolved issues

Rejected

Assignee

Unassigned

Reporter

Gabor Kincses

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure