-->
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.  [ 1 post ] 
Author Message
 Post subject: Exception :: wrong column type when using :: validate
PostPosted: Wed Jul 09, 2008 2:10 am 
Newbie

Joined: Wed Jul 09, 2008 1:19 am
Posts: 1
Hello ,
I am using JPA with Hibernate as the Persistence provider .

I have a working example and I wanted to try out a few changes .

One of them was ::
Code:
<property name="hibernate.hbm2ddl.auto" value="[b]validate[/b]"/>


I changed this attribute to "validate" ( earlier it was "update" )

The DDL that I ran when I created the tables is :: ( using Postgres DB )
Code:

create table Master4(id int,name varchar);

create table Child4(childid int,street varchar,id int);

alter table master4 add constraint p_k_k5 PRIMARY KEY (ID);

alter table child4 add constraint f_k_k5 FOREIGN KEY(ID) REFERENCES MASTER4(ID);



Now whenever I run the example I get the following exception ::

Code:
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: childid, expected: int8
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
   at com.onetoone.postgres.ChildContainsParent.Client.main(Client.java:15)
Caused by: org.hibernate.HibernateException: Wrong column type: childid, expected: int8
   at org.hibernate.mapping.Table.validateColumns(Table.java:261)
   at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)
   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:1294)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)


Regards,
~satish[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.