Cannot export DDL from reverse engineered EJB3 File

Description

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;
}

}

Environment

None

Activity

Show:

Ricardo Rodriguez Garcia May 21, 2012 at 10:12 PM

It works but I'm saying that jdk5 should default to true when ejb3 is set to true, because if I try to load the classes generated with annotation hibernate will refuse to load and
throw a org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity() defined
because it is missing the generics part.

Max Rydahl Andersen May 21, 2012 at 8:01 PM

this bug is 5 years old - are you saying jdk5=true ejb=true does not work for you?

Ricardo Rodriguez Garcia May 21, 2012 at 6:20 PM

What is the duplicate of this bug, I'm using the lastest version of tools and it is still there

Markus Junginger February 15, 2006 at 12:46 PM

I can confirm that this combination worked, which solved my individual problem...

Max Rydahl Andersen February 15, 2006 at 12:22 PM

try and set jdk5="true" together with ejb3="true".

we should detect if jdk5 is false and generate the more specific targetEntity

Duplicate

Details

Assignee

Reporter

Bug 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