-->
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.  [ 10 posts ] 
Author Message
 Post subject: javax/persistence/Entity not present?
PostPosted: Wed Jul 27, 2005 5:49 pm 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
Hi All,

I'm having trouble with getting a schema generated.

I'm using
    3.0 alpha 4a of the tools
    3.1beta1 of hibernate
    3.1beta3 of the annotations


I am getting the following error message from ant
Quote:
Finding class javax.persistence.Inheritance
Loaded from /Users/bdudney/DevTools/hibernate-annotations-3.1beta3/lib/ejb3-persistence.jar javax/persistence/Inheritance.class
Class javax.persistence.Inheritance loaded from ant loader (parentFirst)
Finding class javax.persistence.Entity

BUILD FAILED
/Users/Shared/Applications/Eclipse-3.1/workspace/StockTracker/build.xml:232: java.lang.TypeNotPresentException: Type javax.persistence.Entity not present


Now what I'm confused about here is that ant finds javax.persistence.Inheritance from the same jar that holds javax.persistence.Entity.

Any ideas what I'm doing wrong here?

Thanks!

-bd-


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 6:12 pm 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
This is the whole output from ant when running without debug.

Quote:
build.schema:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.1 beta 1
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using CGLIB reflection optimizer
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] Jul 27, 2005 4:12:48 PM org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null

BUILD FAILED
/Users/Shared/Applications/Eclipse-3.1/workspace/StockTracker/build.xml:232: java.lang.TypeNotPresentException: Type javax.persistence.Entity not present
[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 7:31 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you mean, you have the ejb3-persistence.jar in your classpath?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 9:34 pm 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
Thanks for the reply.

Yes I do have ejb3-persistence.jar in the taskdef classpath. It is not in the hibernatetool classpath.

If I remove hibernate.annotations.classpath from the taskdef classpath it complains that javax.persistence.Column is not found.

Does anyone have a clean ant 1.6.5 + hibernate stuff environment that you could do a quick check on to see if this works for you?

Relevant build.xml segment.

Code:
  <taskdef name="hibernatetool"
           classname="org.hibernate.tool.ant.HibernateToolTask">
    <classpath>
      <path refid="hibernate.annotations.classpath"/>
      <path refid="hibernate.tools.classpath"/>
      <path refid="hibernate.classpath"/>
    </classpath>
  </taskdef>
  <target name="build.schema"
          depends="build.hibernate.domain.jar"
          description="create the schema and populate it with test data">
    <hibernatetool destdir="${hibernate.build.destdir}">
      <classpath>
        <pathelement path="${build.destdir}/${hibernate.jar.name}.jar"/>
        <pathelement path="${build.destdir}/${domain.jar.name}.jar"/>
      </classpath>
      <annotationconfiguration configurationFile="${hibernate.build.destdir}/hibernate.cfg.xml"/>
      <hbm2doc/>
      <!-- build the db from the configuration -->
      <hbm2ddl destdir="blorg.sql"/>
    </hibernatetool>
  </target>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 2:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
known issue with the a4 relase of the tools - fixed in cvs (release upcoming)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 7:47 am 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
Thanks,

Hit the nail on the head.

Is there an ETA on the next release?

TTFN,

-bd-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 11:23 am 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
more class loader problems?

I have an enum in my model and the build.schema target responds that the type is unknown.

Code:
org.hibernate.HibernateException: Enum class not found
        at org.hibernate.type.EnumType.setParameterValues(EnumType.java:154)


The code from EnumType.java

Code:
   public void setParameterValues(Properties parameters) {
      String enumClassName = parameters.getProperty(ENUM);
        try {
            enumClass = Class.forName(enumClassName).asSubclass(Enum.class);
        }
        catch (ClassNotFoundException exception) {
            throw new HibernateException("Enum class not found", exception);
        }
...


Should the look up of the enumClassName be hitting a different class loader?

Thanks,

-bd-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 11:44 am 
Newbie

Joined: Wed Jul 27, 2005 5:38 pm
Posts: 13
Location: Colorado, USA
Not sure this is how you would fix it but the following change to the class lookup seems to have worked for me;

Code:
            enumClass = Class.forName(enumClassName, true, Thread.currentThread().getContextClassLoader()).asSubclass(Enum.class);


Thanks again,

-bd-


Top
 Profile  
 
 Post subject: Re: javax/persistence/Entity not present?
PostPosted: Sun Sep 12, 2010 10:08 am 
Newbie

Joined: Sun Sep 12, 2010 9:14 am
Posts: 2
there is one jar hibernate-jpa sth, add tat should work.


Top
 Profile  
 
 Post subject: Re: javax/persistence/Entity not present?
PostPosted: Wed Jun 22, 2011 2:25 pm 
Newbie

Joined: Fri Jan 02, 2009 2:42 pm
Posts: 2
http://www.codeissue.com/issues/i84e022 ... nce-entity

Please review my post here. I have faced the similar situation and solved it using the description in the following post.
Thanks,
Yogi


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.