hibernate3-maven-plugin: entiries in different maven projects, hbm2ddl fails

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-07T16:23:51Z Indexed on 2010/05/07 16:28 UTC
Read the original article Hit count: 328

Filed under:
|
|
|

I'm trying to put an entity in a different maven project. In the current project I have:

@Entity
public class User {
...
private FacebookUser facebookUser;
...
public FacebookUser getFacebookUser() {
    return facebookUser;
}
...
public void setFacebookUser(FacebookUser facebookUser) {
    this.facebookUser = facebookUser;
}

Then FacebookUser (in a different maven project, that's a dependency of a current project) is defined as:

@Entity
public class FacebookUser {
...
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}

Here is my maven hibernate3-maven-plugin configuration:

        <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>hibernate3-maven-plugin</artifactId>
           <version>2.2</version>
           <executions>
             <execution>
               <phase>process-classes</phase>
               <goals>
                 <goal>hbm2ddl</goal>
               </goals>
             </execution>
           </executions>
           <configuration>
             <components>
               <component>
                 <name>hbm2ddl</name>
                 <implementation>jpaconfiguration</implementation>
               </component>
             </components>
             <componentProperties>
               <ejb3>false</ejb3>
               <persistenceunit>Default</persistenceunit>
               <outputfilename>schema.ddl</outputfilename>
               <drop>false</drop>
               <create>true</create>
               <export>false</export>
               <format>true</format>
             </componentProperties>
           </configuration>
        </plugin>

Here is the error I'm getting:

org.hibernate.MappingException: Could not determine type for: com.xxx.facebook.model.FacebookUser, at table: user, for columns: [org.hibernate.mapping.Column(facebook_user)]

I know that FacebookUser is on the classpath because if I make facebook user transient, project compiles fine:

@Transient
public FacebookUser getFacebookUser() {
    return facebookUser;
}  

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about spring