-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem mapping classes to JMX Hibernate service
PostPosted: Sat Mar 21, 2009 3:10 am 
Newbie

Joined: Sat Mar 21, 2009 2:47 am
Posts: 2
Please help as I'm stuck with this, I'm using the Jboss version that comes with JPortal 2.7.1 (just in case that makes any difference) and not using EJB3, just POJOs. It works perfectly with hbm.xml files, but does not work with annotations. Is there anything wrong and/or missing in my code below?
Thanks


Posted: Sat Mar 21, 2009 7:10 am


I deployed a HAR within an EAR with no problems (within an expanded folder) however it works perfectly only with hbm.xml files and I would like to take advantage of annotations and Hibernate doesn't seem to find my class. When Hibernate starts up, the class does not appear in the console log, and when I try to invoke a class, I get "Unknown Entity".

According to what I read so far this should work, what am I missing? my files are below. thanks!!

Version: JBoss AS 4.2.3.GA, Hibernate 3.2.4.sp1, MySql 5.1


xxx.ear/xxx.har/META-INF/jboss-service.xml

<mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
<attribute name="DatasourceName">java:/MySqlDB</attribute>
<attribute name="SessionFactoryName">java:/hibernate/HibernateSessionFactory</attribute>
<attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
<attribute name="ShowSqlEnabled">true</attribute>
<attribute name="ScanForMappingsEnabled">true</attribute>
</mbean>


xxx.ear/xxx.har/hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<mapping class="beans.data.Class1"/>
</session-factory>
</hibernate-configuration>


compiled into xxx.ear/xxx.har/beans/data/Class1.class
package beans.data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "table1")
public class Class1 {

@Id
@Column(name = "code")
private Integer code;

@Column(name = "description")
private String description;

public Integer getCode() {
return code;
}

public void setCode(Integer code) {
this.code = code;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}


Top
 Profile  
 
 Post subject: Fw: problem mapping classes to JMX Hibernate service
PostPosted: Sun Jun 21, 2009 7:57 am 
Newbie

Joined: Sat Mar 21, 2009 2:47 am
Posts: 2
Does anyone have any answers on this question? Is there any Hibernate support at all in this forum? thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.