Duplicate
Details
Assignee
UnassignedUnassignedReporter
Markus JungingerMarkus JungingerBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Markus JungingerMax Rydahl AndersenRicardo Rodriguez GarciaAffects versions
Priority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
Markus Junginger
Markus JungingerBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Markus Junginger
Max Rydahl Andersen
Ricardo Rodriguez Garcia
Affects versions
Priority
Created February 15, 2006 at 11:12 AM
Updated May 21, 2012 at 10:12 PM
Resolved September 15, 2006 at 1:51 PM
FIrst, I created an EJB3 Java classes using:
<hibernatetool >
<jdbcconfiguration configurationfile="src/hibernate.cfg.xml" revengfile="hibernate.reveng.xml" packagename="de.unilog.ejb3"/>
<hbm2java destdir="src-ejb3" ejb3="true"/>
<hbm2cfgxml destdir="src-ejb3" ejb3="true" />
</hibernatetool>
Then, I tried to let Hibernate Tools parse it's own output to generate DDL:
<hibernatetool>
<annotationconfiguration configurationfile="src-ejb3/hibernate.cfg.xml" />
<hbm2ddl update="true" export="true" outputfilename="demo.ddl" delimiter=";" destdir="."/>
</hibernatetool>
However, I got the following error:
BUILD FAILED
C:\Daten\Projekte\hibernate-tools\build2.xml:4: org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity() defined: de.unilog.ejb3.Kunde.bestellungs
–
PS.: The generated Java file:
package de.unilog.ejb3;
// Generated 15.02.2006 09:53:14 by Hibernate Tools 3.1.0.beta4
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
Kunde generated by hbm2java
*/
@Entity
@Table(name="KUNDE"
, uniqueConstraints = { }
)
public class Kunde implements java.io.Serializable {
// Fields
private int kundeId;
private String name;
private Set bestellungs = new HashSet(0);
// Constructors
/** default constructor */
public Kunde() {
}
/** minimal constructor */
public Kunde(int kundeId) {
this.kundeId = kundeId;
}
/** full constructor */
public Kunde(int kundeId, String name, Set bestellungs) {
this.kundeId = kundeId;
this.name = name;
this.bestellungs = bestellungs;
}
// Property accessors
@Id
@Column(name="KUNDE_ID", unique=true, nullable=false, insertable=true, updatable=true)
public int getKundeId() {
return this.kundeId;
}
public void setKundeId(int kundeId) {
this.kundeId = kundeId;
}
@Column(name="NAME", unique=false, nullable=true, insertable=true, updatable=true, length=99)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="kunde")
public Set getBestellungs() {
return this.bestellungs;
}
public void setBestellungs(Set bestellungs) {
this.bestellungs = bestellungs;
}
}