hibernate3-maven-plugin: entiries in different maven projects, hbm2ddl fails
- by Mike
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;
}