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.
|