-->
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: On starting of Hibernate
PostPosted: Thu Sep 25, 2014 1:38 pm 
Newbie

Joined: Thu Sep 25, 2014 1:24 pm
Posts: 1
Hello,

I get next error on Hibernate start and I´ve search for an answer but I can't find. So my problem is
Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2881)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1795)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
at util.HibernateUtil.getSessionFactory(HibernateUtil.java:33)
at test.Test.main(Test.java:25)

This is the code from Hibernate config:
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@10.191.33.153:1521:DVLP</property>
<property name="hibernate.connection.username">r32</property>
<property name="hibernate.connection.password">r32</property>
and the classes after...

This is the code from Hibernate Util

private static SessionFactory sessionFactory;

public static SessionFactory getSessionFactory() {
if (sessionFactory == null) {
// loads configuration and mappings
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry
= new StandardServiceRegistryBuilder()
.applySettings(configuration.getProperties()).build();

// builds a session factory from the service registry
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}

return sessionFactory;
}

and this is what it should do

public static void main(String[] args) {
Session session=HibernateUtil.getSessionFactory().openSession();
session.getTransaction().begin();
String queryString="FROM TransOper";
Query query=session.createQuery(queryString);
// query.setParameter("mrn", "14PT00001510003601");
List<TransOper> list=query.list();
TransOper result=list.get(0);
System.out.println(result.getSid());
}

Thank you very much for any ideea.


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.