-->
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: Hibernate Annotation - Missing column Exception
PostPosted: Wed Feb 10, 2010 3:23 pm 
Newbie

Joined: Wed Feb 10, 2010 3:13 pm
Posts: 3
Exception:

Caused by: org.hibernate.HibernateException: Missing column: col1 in schema.Table1
at org.hibernate.mapping.Table.validateColumns(Table.java:277)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1130)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)


Here is the hibernate mapping.

ClassA Mapping

@Entity
@Table(name = "Table1")
public class ClassA implements Serializable {

private ClassB _classB = null;

@Embedded
@AttributeOverrides({
@AttributeOverride(name = "col1", column = @Column(name = "db_col1")),
@AttributeOverride(name = "col2", column = @Column(name = "db_col2"))
})
public ClassB getClassB() {
return _classB;
}
}


Class B Mapping

@Embeddable
public class ClassB implements Serializable {

private Long col1;
private Long col2;
private String col3;
private String col4;

/**
* @return the col1
*/
@Column(updatable=false,insertable=false)
public Long getCol1() {
return col1;
}

/**
* @return the col1
*/
@Column(updatable=false,insertable=false)
public Long getCol2() {
return col2;
}
... respective setters.
}


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.