Add a dependency to JPA in your pom.xml
                <dependency>
                        <groupId>javax.persistence</groupId>
                        <artifactId>persistence-api</artifactId>
                        <version>1.0</version>
                </dependency>


2008/9/23 Eric Tchepannou <[EMAIL PROTECTED]>:
> I have read on codehaus's site something like with the plugin installed, we
> don't need the <dependencies> in the pom anymore. However, when I compile
> the project with the command you gave me, it complains about the annotations
> in my class...
>
> .../User.java:[174,5] cannot find symbol
> symbol  : class OneToOne
> location: class com.tcheer.hermann.domain.User
>
> Also, because the jars have not been physically embedded in my project, my
> IDE is complaining too.
>
> hmm...
>
> On Tue, Sep 23, 2008 at 12:54 AM, Johann Reyes <[EMAIL PROTECTED]>
> wrote:
>>
>> Hmm looks like the project is not compiled. Try this
>>
>>
>>
>> Mvn compile hibernate3:hbm2ddl
>>
>>
>>
>> From: Eric Tchepannou [mailto:[EMAIL PROTECTED]
>> Sent: Monday, September 22, 2008 1:33 PM
>> To: user@mojo.codehaus.org
>> Subject: Re: [mojo-user] 'No suitable driver error' with
>> hibernate3:hbm2ddl
>>
>>
>>
>> Hi Johann,
>>
>> Thanks so far for your help. I feel I am getting closer...
>> I actually now have my annotated classes in my cfg.xml.
>> I had to change my pom as to add the annotatedconfiguration implementation
>> as shown below
>>
>>                 <configuration>
>> ...(truncated)...
>>                     <components>
>>                         <component>
>>                             <name>hbm2ddl</name>
>>
>> <implementation>annotationconfiguration</implementation>
>>                         </component>
>>                         <component>
>> ...(truncated)...
>>                 </configuration>
>>
>>
>>  But now get this error:
>> [INFO] Trace
>> org.hibernate.MappingException: Unable to load class declared as <mapping
>> class="com.tcheer.hermann.domain.User"/> in the configuration:
>>
>> Any idea?
>>
>> $ mvn -e hibernate3:hbm2ddl
>> + Error stacktraces are turned on.
>> [INFO] Scanning for projects...
>> [INFO] Searching repository for plugin with prefix: 'hibernate3'.
>> [INFO]
>> ----------------------------------------------------------------------------
>> [INFO] Building hermann
>> [INFO]    task-segment: [hibernate3:hbm2ddl]
>> [INFO]
>> ----------------------------------------------------------------------------
>> [INFO] Preparing hibernate3:hbm2ddl
>> [INFO] [resources:resources]
>> [INFO] Using default encoding to copy filtered resources.
>> [INFO] [hibernate3:hbm2ddl]
>> [INFO] Configuration XML file loaded:
>> file:/Users/tcheer/NetBeansProjects/hermann/src/main/resources/hibernate.cfg.xml
>> 18:25:58,836  INFO org.hibernate.cfg.annotations.Version - Hibernate
>> Annotations 3.3.0.GA
>> 18:25:58,846  INFO org.hibernate.cfg.Environment - Hibernate 3.2.5
>> 18:25:58,848  INFO org.hibernate.cfg.Environment - hibernate.properties
>> not found
>> 18:25:58,849  INFO org.hibernate.cfg.Environment - Bytecode provider name
>> : cglib
>> 18:25:58,852  INFO org.hibernate.cfg.Environment - using JDK 1.4
>> java.sql.Timestamp handling
>> [INFO] Configuration XML file loaded:
>> file:/Users/tcheer/NetBeansProjects/hermann/src/main/resources/hibernate.cfg.xml
>> 18:25:58,896  INFO org.hibernate.cfg.Configuration - configuring from url:
>> file:/Users/tcheer/NetBeansProjects/hermann/src/main/resources/hibernate.cfg.xml
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] FATAL ERROR
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Unable to load class declared as <mapping
>> class="com.tcheer.hermann.domain.User"/> in the configuration:
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Trace
>> org.hibernate.MappingException: Unable to load class declared as <mapping
>> class="com.tcheer.hermann.domain.User"/> in the configuration:
>>     at
>> org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:602)
>>     at
>> org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
>>     at
>> org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
>>     at
>> org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
>>     at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)
>>     at
>> org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.doConfiguration(AbstractComponentConfiguration.java:77)
>>     at
>> org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:40)
>>     at
>> org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87)
>>     at
>> org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
>>     at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>>     at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:585)
>>     at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>     at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>     at
>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>     at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> Caused by: java.lang.ClassNotFoundException:
>> com.tcheer.hermann.domain.User
>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
>>     at
>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>     at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>     at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
>>     at
>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>     at java.lang.Class.forName0(Native Method)
>>     at java.lang.Class.forName(Class.java:164)
>>     at
>> org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
>>     at
>> org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:599)
>>     ... 26 more
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Total time: 2 seconds
>> [INFO] Finished at: Mon Sep 22 18:25:59 BST 2008
>> [INFO] Final Memory: 5M/11M
>> [INFO]
>> ------------------------------------------------------------------------
>>
>> On Mon, Sep 22, 2008 at 5:29 PM, Johann Reyes <[EMAIL PROTECTED]>
>> wrote:
>>
>> Hello Eric
>>
>>
>>
>> Your annotated classes should be included in your hibernate.cfg.xml file
>>
>>
>>
>> Regards
>>
>>
>>
>> Johann
>>
>>
>
>
> --
> Eric Tchepannou
> skype: eric.tchepannou
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to