Hi,
i'm using Hibernate with RMI and when i try to update/delete an object (insert and get works just fine) i get the following exception:
Code:
Exception in thread "main" org.hibernate.MappingException: Unknown entity: $Proxy3
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1246)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:459)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:501)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:491)
at db.StudiengangMapper.update(StudiengangMapper.java:200)
at server.LehrveranstaltungVerwaltungImpl.update(LehrveranstaltungVerwaltungImpl.java:262)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.update(Unknown Source)
at clients.HELPClientStudiengang.main(HELPClientStudiengang.java:130)
this is the class that invokes session.update
Code:
public Studiengang update(Studiengang a) throws HibernateException, RemoteException {
Session session = HibernateUtil.getSession();
Transaction tx = session.beginTransaction();
session.update(a);
tx.commit();
session.close();
session = null;
return a;
}
this is the mapping file:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="data.StudiengangImpl"
table="studiengang">
<id name="ID" column="studiengang_id">
<generator class="native"/>
</id>
<property name="name" column="name"></property>
</class>
</hibernate-mapping>
this is the corresponding class:
Code:
package data;
import java.rmi.RemoteException;
public class StudiengangImpl extends java.rmi.server.UnicastRemoteObject implements Studiengang {
/**
* ID
*/
private int ID = 0;
/**
* Name
*/
private String name = " ";
public StudiengangImpl() throws RemoteException {
super();
}
public int getID() throws RemoteException {
return this.ID;
}
public void setID(int ID) throws RemoteException {
this.ID = ID;
}
public String getName() throws RemoteException {
return this.name;
}
public void setName(String name) throws RemoteException {
this.name = name;
}
}
(as you can see no forgein key relations)
i would be very grateful if somebody could help me