I try to use GWT AutoBean with Hibernate. So I wrote the following entity class:
@Entity(name = "Contact")
public interface Contact {
public interface ContactFactory extends AutoBeanFactory {
ContactFactory INSTANCE = AutoBeanFactorySource.create(ContactFactory.class);
AutoBean<Contact> createContact();
AutoBean<Contact> wrapContact(Contact contact);
}
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
public int getId();
@Column(name = "name")
public String getName();
public void setId(int id);
public void setName(String name);
}
But when I call this method:
public void insert(Contact contact) {
Transaction tx = session.beginTransaction();
session.save(contact);
tx.commit();
}
I get the following exception:
org.hibernate.MappingException: Unknown entity: com.sun.proxy.$Proxy11
I googled a bit and I read that AutoBean creates a proxy for accessing the properties of the bean. I think there are maybe a conflict between AutoBean's proxy and Hibernate's proxy. Or maybe Hibernate cannot get the @Entity annotation and get the entity name property.
Someone has used GWT and hibernate autobean ? Thanks you in advance.