-->
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: Error when install FactorySession
PostPosted: Wed Jul 08, 2009 5:51 am 
Newbie

Joined: Fri Jun 19, 2009 7:02 pm
Posts: 4
This is my class Main
Code:
import org.hibernate.*;
import org.hibernate.cfg.Configuration;
public class Main {
    public static void main(String[] arg) {
        SessionFactory factory = new Configuration().configure().buildSessionFactory(); //error here
        Session session = factory.openSession();

        Transaction transaction = null;
        try {
            transaction = session.beginTransaction();
            Person p1 = new Person();
            p1.setPName("mike tyson");
            session.save(p1);
            transaction.commit();
            transaction = null;
            System.out.println("Thanh cong");
        }
        catch (Exception exp){
            if ( transaction != null ){
                transaction.rollback();
            }
            System.out.println("That bai");
        }
        finally {
            session.close();
        }
    }
}


this is my file config:
Code:
<?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>
       
        <property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver
        </property>
        <property name="connection.url">jdbc:derby://localhost:1527/mydatabase
        </property>
        <property name="connection.username">app
        </property>
        <property name="connection.password">app
        </property>
       
        <property name="dialect">org.hibernate.dialect.DerbyDialect
        </property>
       
        <mapping resource="Person.hbm.xml"/>
    </session-factory>
</hibernate-configuration>




My application error at install FactorySession in class Main. I build it no problem but when i run project, it messenger error

Help me please !! Thank a lot of


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.