I'm having problems trying to save an object of type
MembershipImpl.
It's giving me the following error:
Code:
net.sf.hibernate.MappingException: No persister for: pt.impl.MembershipImpl
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2574)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2581)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:725)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717)
at pt.comseal.arsol.bo.autenticacao.AutenticacaoBO.inserirMembership(AutenticacaoBO.java:32)
-----------------
Mapping file
-----------------
MembershipImplCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="pt.impl.MembershipImpl"
table="MEMBERSHIP"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="long"
unsaved-value="null"
>
<generator class="pt.util.db.IdGenerator">
</generator>
</id>
<property
name="role"
type="string"
update="true"
insert="true"
column="role"
/>
<property
name="type"
type="string"
update="true"
insert="true"
column="type_"
/>
<many-to-one
name="group"
class="pt.impl.GroupImpl"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="group_"
/>
<many-to-one
name="user"
class="pt.impl.UserImpl"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="user_"
/>
</class>
</hibernate-mapping>
-----------
POJO
-----------
Code:
package pt.impl;
import pt.*;
/**
* @hibernate.class table="MEMBERSHIP"
*/
public class MembershipImpl implements Membership {
// persistent properties
/**
* @hibernate.id column="id" type="long" unsaved-value="null" generator-class="pt.util.db.IdGenerator"
*/
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
/**
* @hibernate.property type="string" column="role"
*/
public String getRole() { return role; }
public void setRole(String role) { this.role = role; }
/**
* @hibernate.property type="string" column="type_"
*/
public String getType() { return type; }
public void setType(String type) { this.type = type; }
/**
* @hibernate.many-to-one class="pt.impl.GroupImpl"
* cascade="all" column="group_"
*/
public Group getGroup() { return group; }
public void setGroup(Group group) { this.group = group; }
/**
* @hibernate.many-to-one class="pt.impl.UserImpl"
* cascade="all" column="user_"
*/
public User getUser() { return user; }
public void setUser(User user) { this.user = user; }
// toString
public String toString() {
return "Membership[" + id + "|" + user.getName() + "|" + group.getName() + "]";
}
// private members
private Long id = null;
private String role = null;
private String type = null;
private Group group = null;
private User user = null;
}