Hallo zusammen,
ich hab da ein Problem mit JPA Annotations in meineer Testanwendung.
Ich möchte ein UniqueConstraint per Annotation festlegen, dazu sieht der Code so aus ( aus Platzgründen hab ich die Getter/Setter mal weg gelassen:
Die beiden Klassen dazu sehen we folgt aus:
wenn ich das ganze nun per mvn clean test durchjage kommt folgende Exception
org.hibernate.MappingException: Could not determine type for: de.***.***.***.hibernate.entity.article.ProductDO, for columns: [org.hibernate.mapping.Column(PRODUCT)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
at org.hibernate.mapping.Column.getSqlType(Column.java:182)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:394)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:848)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:94)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:96)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:152)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
Kann mir jemand erklären woran das liegt, weil irgendwie gehen mir langsam die Idee aus?
grüße keks
ich hab da ein Problem mit JPA Annotations in meineer Testanwendung.
Ich möchte ein UniqueConstraint per Annotation festlegen, dazu sieht der Code so aus ( aus Platzgründen hab ich die Getter/Setter mal weg gelassen:
Java:
@Entity
@Table(name = "PRODUCT2QUANTITY", uniqueConstraints = { @UniqueConstraint(columnNames = {
"PRODUCT", "QUANTITY" }) })
@PrimaryKeyJoinColumn(name = "SAID")
public class ProductQuantityDO extends SearchableDO {
@Column(nullable = false)
private BigDecimal price;
@Column(name = "PRODUCT")
private ProductDO product;
@Column(name = "QUANTITY")
private QuantityDO quantity;
}
Die beiden Klassen dazu sehen we folgt aus:
Java:
@Entity
@Table(name = "T_SA_PRODUCT")
@DiscriminatorValue("PRODUCT")
@PrimaryKeyJoinColumn(name = "SAID")
// SAID = SearchableDO.id
public class ProductDO extends SearchableDO {
private String name;
@ManyToOne
private ManufacturerDO manufacturer;
@Lob
private String description;
}
Java:
@Entity
@Table(name = "T_SA_QUANTITY")
public class QuantityDO extends EntityObjectDO {
private int volume;
}
wenn ich das ganze nun per mvn clean test durchjage kommt folgende Exception
org.hibernate.MappingException: Could not determine type for: de.***.***.***.hibernate.entity.article.ProductDO, for columns: [org.hibernate.mapping.Column(PRODUCT)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
at org.hibernate.mapping.Column.getSqlType(Column.java:182)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:394)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:848)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:94)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:96)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:152)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
Kann mir jemand erklären woran das liegt, weil irgendwie gehen mir langsam die Idee aus?
grüße keks