Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Unknown integral data type
PostPosted: Wed Nov 02, 2011 5:10 am 
Newbie

Joined: Wed Nov 02, 2011 4:53 am
Posts: 2
Location: Belgium
Hey,

I'm currently working on a project which uses Hibernate 3.2.5. The project leaders want to upgrade to version 3.5.
However, there seems to be a problem with the id generator.

In the XML mapping file we use the following to define a unique id in the table:

<id name="id" type="string">
<column name="ID" length="32" />
<generator class="uuid.hex" />
</id>


During testing, the following error occurred:

...could not be saved: Unknown integral data type for ids : java.lang.String

The error is raised by the class org.hibernate.id.IdentifierGeneratorHelper. It seems that only numerical values are allowed.

Is there a way to fix this problem without touching the database?

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Unknown integral data type
PostPosted: Wed Apr 04, 2012 8:05 am 
Newbie

Joined: Wed Apr 04, 2012 7:37 am
Posts: 2
Hello,

I have the same problems using JPA 2.0 in Java EE 6.

My entity class looks like this :
Code:
@Entity
@EntityListeners({MultiLangStringEntityListener.class})
@Table(name = "DM_PHYSICAL_PROPERTY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DmPhysicalProperty.findAll", query = "SELECT d FROM DmPhysicalProperty d"),
    @NamedQuery(name = "DmPhysicalProperty.findByPhysicalPropertyId", query = "SELECT d FROM DmPhysicalProperty d WHERE d.physicalPropertyId = :physicalPropertyId"),
public class DmPhysicalProperty implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DM_PHYSICAL_PROPERTY")
    @SequenceGenerator(name = "SEQ_DM_PHYSICAL_PROPERTY", sequenceName = "SEQ_DM_PHYSICAL_PROPERTY", allocationSize = 1)
    @Column(name = "PHYSICAL_PROPERTY_ID")
    private String physicalPropertyId;
...
}


An when I call the persist method, I have the following error :
Code:
13:29:11,716 ERROR [org.jboss.ejb3.tx2.impl.CMTTxInterceptor] javax.ejb.EJBTransactionRolledbackException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
13:29:11,779 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] Method invocation failed with exception: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String: javax.ejb.EJBTransactionRolledbackException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
   at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:148) [:0.0.2]
   at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:227) [:0.0.2]
   at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:353) [:0.0.2]
   at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.2]
   at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.2]
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.2.GA]
   at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA]
....


The database used is "Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production".

The same entity code works fine with EclipseLink (JPA 2.0) on GlassFish 3.1.2 Server.

I want to move to JBoss server, I have tested with JBoss 6.1.0 Final (and thus with Hibernate 3.6.6 Final) but I have this error.

I have also tested with GlassFish 3.1.2 and Hibernate 3.5.0-Final with the same error.

What does I have missed ?

Is this a sort of limitation in Hibernate ?

This error is annoying and prevent me to use JBoss application server ...

Best regards,
Laurent


Top
 Profile  
 
 Post subject: Re: Unknown integral data type
PostPosted: Fri Apr 06, 2012 9:43 am 
Newbie

Joined: Wed Apr 04, 2012 7:37 am
Posts: 2
Hello,
Please someone could help ?
At least a JPA confirmed user could tell if I have not forgot something.
To summarize : I have an ID String column and I want to use a sequence to fill it when created with JPA.
--
Laurent


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.