-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: MappingExecption: No persistor... ?
PostPosted: Mon Jan 12, 2004 12:24 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
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
-----------------

MembershipImpl
Code:
<?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;
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 1:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Not added the mapping file to your configuration?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 2:32 pm 
Newbie

Joined: Wed Jan 14, 2004 2:27 pm
Posts: 2
gloeglm wrote:
Not added the mapping file to your configuration?


I'm having the same problem. The application I am working with was developed by someone else. I am just now learning how to implement hibernate (which they had already done). I cannot find the configuration file. Where should it be located?

The web application references their implementation of hibernate in a file they called persistent.jar, which contains all the java classes and mapping files. I don't see a configuration file there.

Any ideas would be helpful.

This is running in a JBoss 3.2.3 environment.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 2:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you are running JBoss, there is either a hibernate.cfg.xml() in your jar root directory, or hibernate is configured as an mbean, then look out for a jboss-service.xml where hibernate is configured (may be in a seperate SAR)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 2:44 pm 
Newbie

Joined: Wed Jan 14, 2004 2:27 pm
Posts: 2
Wow! Thanks for the fast response!

Exactly as you suspected, I found a jboss-service.xml in a hibernate-admin.sar in the deployment of my application.

Thank you very much!

PS - Probably more dumb questions coming from this direction soon. Stay tuned.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.