-->
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: Why hibernate-annotation run error?
PostPosted: Fri Aug 10, 2007 2:44 am 
Newbie

Joined: Fri Aug 10, 2007 2:31 am
Posts: 1
my hibernate configuration is:

<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>

<mapping class="com.mytest.db.mapping.Test1"/>
</session-factory>


my POJO Test1 is:

package com.mytest.db.mapping;

import javax.persistence.*;

@Entity
@Table(name="test1")
public class Test1 {
@Id
private String test_id;

private String test_name;

private String test_description;

public String getTest_description() {
return test_description;
}

public void setTest_description(String test_description) {
this.test_description = test_description;
}

public String getTest_id() {
return test_id;
}

public void setTest_id(String test_id) {
this.test_id = test_id;
}

public String getTest_name() {
return test_name;
}

public void setTest_name(String test_name) {
this.test_name = test_name;
}
}


now I run the following code:

public class TestBA {

/**
* @param args
*/
public static void main(String[] args) {
Test1 test1 = new Test1();
test1.setTest_id("001");
test1.setTest_name("a");
test1.setTest_description("des1");

AnnotationConfiguration config = new AnnotationConfiguration();
sessionFactory = config.configure("hibernate.cfg.xml").buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.save(test1);
tx.commit();
}

}


but the I given the error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/InheritanceJoinColumns
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:324)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:177)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:999)
at com.mytest.db.HibernateUtil.<clinit>(HibernateUtil.java:15)
at com.mytest.db.TestBA.main(TestBA.java:19)


why? where could I get the class javax/persistence/InheritanceJoinColumns?


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.