Results 1 to 1 of 1
  1. #1
    wassimbik is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default Problème avec Hibernate

    Hello all

    I have a problem with hibernate: I have installed Hibernate3 hibernate2 and I import them.But the problem persists at the session.

    My java code:

    import net.*;
    import org.*;
    import com.*;
    import java.util.*;
    import net.sf.hibernate.*;
    import com.test.java.hibernate.*;

    public class Test{
    public static void main(String[]args) throws HibernateException{
    //The method beginTransaction() is undefined for the type Session
    Session session=HibernateUtil.currentSession();
    Transaction tx=session.beginTransaction();
    TContact contact= new TContact();
    contact.setNom("Dupont");
    contact.setPrenom("Jean");
    contact.setAge(new Integer(44));
    session.save(contact);
    contact= new TContact();
    contact.setNom("Lambert");
    contact.setPrenom("Julie");
    contact.setAge(new Integer(27));
    session.save(contact);
    tx.commit();
    HibernateUtil.closeSession();

    }
    }
    Last edited by wassimbik; 07-22-2010 at 12:24 PM.

Similar Threads

  1. probleme with my code
    By yacin87 in forum Networking
    Replies: 0
    Last Post: 04-13-2010, 12:17 AM
  2. probleme with assert statement
    By pierre in forum New To Java
    Replies: 3
    Last Post: 10-23-2009, 10:10 PM
  3. Hibernate DAO
    By sundarjothi in forum Eclipse
    Replies: 0
    Last Post: 04-26-2008, 08:29 AM
  4. hibernate
    By vipinpvijayan in forum Web Frameworks
    Replies: 1
    Last Post: 04-21-2008, 05:41 PM
  5. Replies: 2
    Last Post: 06-30-2007, 03:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •