-->
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.  [ 6 posts ] 
Author Message
 Post subject: NoSuchMethodError: *.NamingStrategy.foreignKeyColumnName(..)
PostPosted: Fri May 12, 2006 1:15 pm 
Newbie

Joined: Fri May 12, 2006 12:18 pm
Posts: 4
Location: Karlsruhe, Germany
Hi there,

this is my first posting here, so please be lenient toward me. If something misses in my posting, please give me a hint.

I'm trying to use the EntityManager without a J2EE / JBoss environment. I registered all my EntityBeans in the persistence.xml and made the proper settings for the DB connection.

Within my JBoss environment all beans and the DB settings function properly, so I don't think it has to do with my beans.

Any hints?


Regards,
Hauke


Hibernate version:
Hibernate-Version: 3.2.0.cr2
Hibernate EntityManager: 3.1.0.Beta8

Name and version of the database you are using:
PostgreSQL 8.0

persistence.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<persistence>
   
   <persistence-unit name="plyd" transaction-type="RESOURCE_LOCAL">
   
      <class>plyd.model.ListOfAlternativeServices</class>
      <class>plyd.model.ServiceSelection</class>
      <class>plyd.model.Brand</class>
      
      <class>plyd.model.business.Bill</class>
      <class>plyd.model.business.Contract</class>
      <class>plyd.model.business.CustomerOrder</class>
      <class>plyd.model.business.Product</class>

      <class>plyd.model.customer.Address</class>
      <class>plyd.model.customer.BankAccount</class>
      <class>plyd.model.customer.CustomerAccount</class>
      <class>plyd.model.customer.CustomerEMail</class>
      <class>plyd.model.customer.PhoneNumber</class>
      <class>plyd.model.customer.Sex</class>
      <class>plyd.model.customer.UserConfig</class>
      
      <class>plyd.model.farm.Deploy</class>
      <class>plyd.model.farm.Farm</class>
      <class>plyd.model.farm.Node</class>

      <class>plyd.model.ressource.Architecture</class>
      <class>plyd.model.ressource.Archive</class>
      <class>plyd.model.ressource.ArchiveId</class>
      <class>plyd.model.ressource.Dependency</class>      
      <class>plyd.model.ressource.FileBlob</class>      
      <class>plyd.model.ressource.OperatingSystem</class>
      <class>plyd.model.ressource.PlydService</class>
      <class>plyd.model.ressource.Resource</class>
      <class>plyd.model.ressource.Type</class>
      
      <class>plyd.model.ressource.validation.ConfigOption</class>
      <class>plyd.model.ressource.validation.ConfigValidationPattern</class>
      <class>plyd.model.ressource.validation.DataType</class>
      <class>plyd.model.ressource.validation.DomainRestriction</class>
      <class>plyd.model.ressource.validation.ValidationDescription</class>
      
      <properties>
         <property name="jboss.entity.manager.jndi.name" value="java:/EntityManager/plyd"/>
         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
         <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
         <property name="hibernate.connection.username" value="xxxx" />
         <property name="hibernate.connection.password" value="xxxx" />
         <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/plyd" />
         <provider>org.hibernate.ejb.HibernatePersistence</provider>
       </properties>
       
   </persistence-unit>
   
</persistence>


Full stack trace of any exception that occurs:
Code:
12.05.2006 18:45:05 org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.1.0.Beta8b
12.05.2006 18:45:05 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.1.0.Beta10b
12.05.2006 18:45:05 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2 cr2
12.05.2006 18:45:05 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
12.05.2006 18:45:05 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
12.05.2006 18:45:05 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
12.05.2006 18:45:06 org.hibernate.ejb.packaging.FileZippedJarVisitor doProcessElements
WARNUNG: Unable to find file (ignored): file:/C:/Dokumente%20und%20Einstellungen/MojoPojo/Eigene%20Dateien/Development/workspace/plyd.core%5bBRANCH%5d/bin/java-test
java.util.zip.ZipException: Zugriff verweigert
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34)
   at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208)
   at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201)
   at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183)
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
   at plyd.test.EntitiyManagerTest.main(EntitiyManagerTest.java:26)
12.05.2006 18:45:06 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ListOfAlternativeServices
12.05.2006 18:45:06 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ListOfAlternativeServices on table ListOfAlternativeServices
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ServiceSelection
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ServiceSelection on table ServiceSelection
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.Brand
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.Brand on table Brand
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.business.Bill
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.business.Bill on table Bill
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.business.Contract
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.business.Contract on table Contract
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.business.CustomerOrder
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.business.CustomerOrder on table CustomerOrder
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.business.Product
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.business.Product on table Product
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.Address
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.Address on table Address
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.BankAccount
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.BankAccount on table BankAccount
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.CustomerAccount
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.CustomerAccount on table CustomerAccount
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.CustomerEMail
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.CustomerEMail on table CustomerEMail
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.PhoneNumber
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.PhoneNumber on table PhoneNumber
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.customer.UserConfig
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.customer.UserConfig on table UserConfig
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.farm.Deploy
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.farm.Deploy on table Deploy
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.farm.Farm
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.farm.Farm on table Farm
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.farm.Node
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.farm.Node on table Node
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.Architecture
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.Architecture on table Architecture
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.Archive
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.Archive on table Archive
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.Dependency
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.Dependency on table Dependency
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.OperatingSystem
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.OperatingSystem on table OperatingSystem
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.PlydService
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.PlydService on table PlydService
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.Resource
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.Resource on table Resource
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.Type
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.Type on table Type
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.validation.ConfigOption
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.validation.ConfigOption on table ConfigOption
12.05.2006 18:45:07 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.validation.ValidationDescription
12.05.2006 18:45:07 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.validation.ValidationDescription on table ValidationDescription
12.05.2006 18:45:08 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.validation.ConfigValidationPattern
12.05.2006 18:45:08 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: plyd.model.ressource.validation.DomainRestriction
12.05.2006 18:45:08 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity plyd.model.ressource.validation.DomainRestriction on table DomainRestriction
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.cfg.NamingStrategy.foreignKeyColumnName(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
   at org.hibernate.cfg.Ejb3JoinColumn.linkValueUsingDefaultColumnNaming(Ejb3JoinColumn.java:266)
   at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:198)
   at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:45)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:261)
   at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
   at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:868)
   at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:163)
   at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:641)
   at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:134)
   at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188)
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
   at plyd.test.EntitiyManagerTest.main(EntitiyManagerTest.java:26)


Top
 Profile  
 
 Post subject: core cr2 not backward compatible with cr1
PostPosted: Mon May 15, 2006 3:36 am 
Hi,
Hibernate core 3.2.0cr2 changed as far as NamingManager is concerned like you said, which makes it incompatible with entity manager 3.1.0.Beta8. stick with cr1 in the meantime.


Top
  
 
 Post subject:
PostPosted: Mon May 15, 2006 7:38 am 
Newbie

Joined: Fri May 12, 2006 12:18 pm
Posts: 4
Location: Karlsruhe, Germany
Thank you so much! That hit the spot! :-)

Where can I get those "dependency / compatibility informations" about the entity manager and the matching core versions? I didn't find anything about this in the changelogs or the news section.


Top
 Profile  
 
 Post subject: incompatibilities
PostPosted: Mon May 15, 2006 8:19 am 
Once I saw the MethodNotFoundError, I looked at the source in cr1 and cr2, like you probably did.

the other strange thing I found in the entity manager is the missing getManager() in EntityManagerFactory that comes from the ejb persistence jar bundled with either the cr1 and cr2. what is puzzling is that the now approved spec contains the source of the EntityManagerfactory with the missing method p.114. this thing definitely needs some stability because they had the method at one point, then it got removed in entity manager because the spec supposedly removed it at one point, (before adding it back?).

in the meantime I am doing what they used to do in their implementation:

HibernateEntityManagerFactory sessionFactory = ((HibernateEntityManagerFactory) factory).getSessionFactory();
return new CurrentEntityManagerImpl(sessionFactory, PersistenceUnitTransactionType.JTA);

this si the early adopter syndrome. It will be better in a few months.


Top
  
 
 Post subject:
PostPosted: Mon May 15, 2006 8:58 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Use Hibernate Annotations 3.2.0.CR1 and Hibernate EntityManager 3.2.0.CR1
EMF.getEnttiyManager() is no longer part of the EJB3 Specification

_________________
Emmanuel


Top
 Profile  
 
 Post subject: getEntityManager not available anymore
PostPosted: Tue May 16, 2006 4:42 am 
I can see it now in the final release of the spec.

Is that to say that ejb3 persistence cannot be used yet in containers that do not support dependency injection? or that we have to do application managed entity manager for those containers?

thanks,
vincent


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

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.