I am getting the following exception
Caused by: java.lang.NoSuchMethodError: table
at org.hibernate.cfg.Ejb3Column.buildColumnFromAnnotation(Ejb3Column.java:364)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:963)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:210)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:722)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:161)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:567)
at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:118)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:165)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:103)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at com.dst.util.EJB3Util.(EJB3Util.java:18)
at com.dst.util.EJB3Util.getInstance(EJB3Util.java:23)
at com.dst.beans.SampleBean.createCustomer(SampleBean.java:40)
at com.dst.beans.SampleBean_osda5w_EOImpl.createCustomer(SampleBean_osda5w_EOImpl.java:59)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.apache.beehive.controls.system.ejb.EJBControlImpl.invoke(EJBControlImpl.java:332)
at controls.sampleBeanControlBean.createCustomer(sampleBeanControlBean.java:181)
at Controller.begin(Controller.java:32)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:853)
at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:783)
I am using 2 simple classes Customer and Address
package com.dst.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.GenericGenerator;
/**
* The persistent class for the CUSTOMER database table.
*/
@Entity()
@Table(name="CUSTOMER")
public class Customer implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
private String customerId;
private String customerName;
private java.util.Set<Address> addresses;
public Customer() {
}
@Id @GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(name="CUSTOMER_ID", unique=true, nullable=false, length=100)
public String getCustomerId() {
return this.customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
@Basic()
@Column(name="CUSTOMER_NAME", nullable=false, length=100)
public String getCustomerName() {
return this.customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
@OneToMany(mappedBy="customer")
public java.util.Set<Address> getAddresses() {
return this.addresses;
}
public void setAddresses(java.util.Set<Address> addresses) {
this.addresses = addresses;
}
public String toString() {
return new ToStringBuilder(this)
.append("customerId", getCustomerId())
.toString();
}
}
-------------------------------
package com.dst.model;
import java.io.Serializable;
import org.apache.commons.lang.builder.ToStringBuilder;
import javax.persistence.*;
/**
* The persistent class for the ADDRESS database table.
*/
@Entity()
@Table(name="ADDRESS")
public class Address implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
private String addressId;
private String city;
private String streetName;
private String zip;
private Customer customer;
public Address() {
}
@Id()
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ADDRESS_ID", unique=true, nullable=false, length=100)
public String getAddressId() {
return this.addressId;
}
public void setAddressId(String addressId) {
this.addressId = addressId;
}
@Basic()
@Column(name="CITY", length=10)
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
@Basic()
@Column(name="STREET_NAME", length=100)
public String getStreetName() {
return this.streetName;
}
public void setStreetName(String streetName) {
this.streetName = streetName;
}
@Basic()
@Column(name="ZIP", length=10)
public String getZip() {
return this.zip;
}
public void setZip(String zip) {
this.zip = zip;
}
@ManyToOne()
@JoinColumn(name="CUSTOMER_ID", referencedColumnName="CUSTOMER_ID")
public Customer getCustomer() {
return this.customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public String toString() {
return new ToStringBuilder(this)
.append("addressId", getAddressId())
.toString();
}
}
|