[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-599?page=all ]
Max Rydahl Andersen closed HBX-599:
-----------------------------------
Resolution: Duplicate
Cannot export DDL from reverse engineered EJB3 File
---------------------------------------------------
Key: HBX-599
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-599
Project: Hibernate Tools
Type: Bug
Versions: 3.1beta4
Reporter: Markus Junginger
Priority: Minor
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;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira