-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with hibernate AnnotationConfiguration
PostPosted: Tue May 13, 2008 5:09 pm 
Newbie

Joined: Mon May 12, 2008 3:31 pm
Posts: 4
Hi all,
I have the following in hibernation.cfg.xml file
?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://mysql.wolfram.com:3324/search_info_tst</property>
<property name="hibernate.connection.username">search_user_tst</property>
<property name="hibernate.connection.password">wrselohetst</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<!-- <mapping resource="contact.hbm.xml"/> -->
<mapping class="com..hibernate.Contact"/>
</session-factory>
</hibernate-configuration>

and com.hibernate.Contact.java is as follows

import javax.persistence.*;

@Entity
@Table(name = "test")
public class Contact {
@Id @GeneratedValue
@Column(name = "id")
private int id;
@Column(name = "name")
private String name;
@Column(name = "ssn")
private int ssn;
@Column(name = "email")
private String email;

public void setName(String name){
this.name = name;
}

public String getName(){
return this.name;
}

public void setId(int id){
this.id = id;
}

public int getId(){
return this.id;
}

public void setSsn(int ssn){
this.ssn = ssn;
}

public int getSsn(){
return this.ssn;
}

public void setEmail(String email){
this.email = email;
}

public String getEmail(){
return this.email;
}
}
and in one of my .java I have,
SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

but this returns null... SessionFactory obj is not getting created.. am i doing anything wrong?


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

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.