Results 1 to 7 of 7
  1. #1
    elururajesh is offline Member
    Join Date
    Apr 2014
    Posts
    4
    Rep Power
    0

    Default Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    I am using hibernate 4.3.5 library.In that buildSessionFactory() method is strikethrough and giving problem under Configuration. Because of that it is not allowing to run hibernate java application. Can anyone please help?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    According to the API you should be using the other buildSessionFactory.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    elururajesh is offline Member
    Join Date
    Apr 2014
    Posts
    4
    Rep Power
    0

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    If you dont mind please guide me how to configure the hibernate.cfg.xml in java class main method

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    No idea off the top of my head.
    I'd have to go through the documentation as I've only got a Play application in front of me at the moment, so nothing I can easily refer to.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    elururajesh is offline Member
    Join Date
    Apr 2014
    Posts
    4
    Rep Power
    0

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    I have gone through the documentation and found as follows:
    SessionFactory sf=null;
    try{
    sf=new Configuration().configure().buildSessionFactory(ne w StandardServiceRegistryBuilder().build() );
    }catch(Throwable ex){}

    14: Session session=sf.getCurrentSession();
    Transaction tx=session.beginTransaction();
    ================================================== =======================================
    Still some problem with the above code:
    2014-04-10 20:00:37 INFO Version:66 - HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
    2014-04-10 20:00:37 INFO Version:54 - HHH000412: Hibernate Core {4.3.5.Final}
    2014-04-10 20:00:37 INFO Environment:239 - HHH000206: hibernate.properties not found
    2014-04-10 20:00:37 INFO Environment:346 - HHH000021: Bytecode provider name : javassist
    2014-04-10 20:00:37 INFO Configuration:2073 - HHH000043: Configuring from resource: /hibernate.cfg.xml
    2014-04-10 20:00:37 INFO Configuration:2092 - HHH000040: Configuration resource: /hibernate.cfg.xml
    2014-04-10 20:00:39 INFO Configuration:757 - HHH000221: Reading mappings from resource: employee.hbm.xml
    2014-04-10 20:00:40 INFO Configuration:757 - HHH000221: Reading mappings from resource: address.hbm.xml
    2014-04-10 20:00:40 INFO Configuration:2214 - HHH000041: Configured SessionFactory: null
    2014-04-10 20:00:41 WARN ConnectionProviderInitiator:145 - HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
    Exception in thread "main" java.lang.NullPointerException
    at ex.Store.main(Store.java:14)
    ================================================== ===================================
    Ref:http://docs.jboss.org/hibernate/orm/...firstapp-setup
    Last edited by elururajesh; 04-10-2014 at 04:36 PM.

  6. #6
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,052
    Rep Power
    6

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    Quote Originally Posted by elururajesh View Post
    If you dont mind please guide me how to configure the hibernate.cfg.xml in java class main method
    My god, why? You have the -internet- available to you!

    Google: hibernate 4 build configuration in java
    First hit: How To Create Session Factory in Hibernate 4

    If that is not enough, look at more hits of the above search or do some related searches.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    elururajesh is offline Member
    Join Date
    Apr 2014
    Posts
    4
    Rep Power
    0

    Default Re: Configuration.buildSessionFactory() method is giving problem in hibernate 4.3.5

    With the above link it got connected, Thanks

Similar Threads

  1. org.hibernate.MappingException: invalid configuration?
    By blertadhimitri in forum New To Java
    Replies: 6
    Last Post: 01-30-2014, 12:10 PM
  2. Replies: 2
    Last Post: 10-23-2013, 09:36 AM
  3. Replies: 13
    Last Post: 01-09-2013, 05:51 PM
  4. Replies: 3
    Last Post: 08-30-2012, 06:24 PM
  5. Could not parse configuration: /hibernate.cfg.xml
    By Matang in forum Web Frameworks
    Replies: 2
    Last Post: 04-10-2011, 02:28 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
  •