-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping error with PostgreSQL
PostPosted: Fri Jan 04, 2013 12:23 pm 
Newbie

Joined: Fri Jan 04, 2013 11:34 am
Posts: 3
HI,

I got a problem with a postgreSQL database (9.2.2) and hibernate (3.2.6.ga).
Exception:
Code:
org.hibernate.HibernateException: Wrong column type in public.alert for column LEVEL. Found: int4, expected: INTEGER
   at org.hibernate.mapping.Table.validateColumns(Table.java:261)
   at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1089)
   at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)


hbm.xml:
Code:
        <property name="level" type="com.intesens.idp.model.alert.domain.AlertLevelEnum">
            <column name="LEVEL" not-null="true" unique="false" sql-type="INTEGER"/>
        </property>


SQL script:
Code:

create table ALERT (
        ID BIGINT not null,
        LEVEL INTEGER not null,
        primary key (ID)
    );


int4 is an alias for integer (postgresql documentation). Is there a bug with that in this hibernate release ?
Does anybody already got this ?

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Mapping error with PostgreSQL
PostPosted: Mon Jan 07, 2013 5:48 am 
Newbie

Joined: Fri Jan 04, 2013 11:34 am
Posts: 3
The bug occurs only when the property "hibernate.hbm2ddl.auto" is set to "validate".
So my workaround is to remove this property from hibernate configuration file.

Is it a bug ?


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