Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate Annotationconfiguration deprecated and its replacement

Have Programming Question? Ask it here!
 
 
 


Java Coder
Annotationconfiguration deprecated and its replacement
1 Answer(s)      7 months ago
Posted in : Hibernate


Hi,

In Hibernate 4 annotationconfiguration is deprecated. Can you tell me what will be its replacement?

Thanks


Advertisement
View Answers

December 19, 2013 at 11:51 AM


Hi,

You can use the following code in your program:

package net.roseindia;
import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateUtil {
    private static final SessionFactory sessionFactory;

    private static ServiceRegistry serviceRegistry;


    static {

        try {
/*
            Configuration configuration = new Configuration();
            sessionFactory = configuration.configure().buildSessionFactory();
    */

            Configuration configuration = new Configuration();
            configuration.configure();
            serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
            sessionFactory = configuration.buildSessionFactory(serviceRegistry);


        } catch (Throwable th) {

            System.err.println("Enitial SessionFactory creation failed" + th);

            throw new ExceptionInInitializerError(th);

        }

    }

    public static SessionFactory getSessionFactory() {

        return sessionFactory;

    }
}

Hope this will help you.

Read more tutorials at Hibernate Tutorials page.

Thanks



Related Tutorials/Questions & Answers:
Annotationconfiguration deprecated and its replacement
Annotationconfiguration deprecated and its replacement  Hi, In Hibernate 4 annotationconfiguration is deprecated. Can you tell me what will be its replacement? Thanks   Hi, You can use the following code in your
What is deprecated?
What is deprecated?  What is mean by deprecated element, method or class?   What is deprecated? Deprecated means condemned. A object... is showing a deprecated message that means it is either outdated or has been
Advertisements
MPMoviePlayerContentPreloadDidFinishNotification' is deprecated
MPMoviePlayerContentPreloadDidFinishNotification' is deprecated  Hi, While compiling compiler is giving following error: warning: 'MPMoviePlayerContentPreloadDidFinishNotification' is deprecated (declared at /Developer
UIKeyboardBoundsUserInfoKey is deprecated
UIKeyboardBoundsUserInfoKey is deprecated  On running my application i am getting a warning as given below... " UIKeyboardBoundsUserInfoKey is deprecated " What is the cause of it?? and what should i use instead
Is buildSessionFactory() deprecated in hibernate 4?
Is buildSessionFactory() deprecated in hibernate 4?  Hi, I am trying to develop an application in Hibernate 4. I am using the Hibernate 4.3.0.final... sessions = cfg.buildSessionFactory(); But when I am using it in Hibernate 4 its
Java making a method deprecated
Java making a method deprecated  java making a method deprecated...; Declare "@Deprecated" before a method to create a method deprecated in your Java application. Though, it is not a correct way to use a deprecated class
HTTP_POST_VARS is deprecated
HTTP_POST_VARS is deprecated  HTTPPOSTVARS is deprecated. Which function to be used? Thanks   Hi, You should use: $id=$_GET["id"]; or $id=$_POST["id"]; thanks
Function split() is deprecated
Function split() is deprecated  Hi, The Function split() is deprecated in latest version of PHP 5.5.23? What is the solution? Thanks   Hi, Use the following function: array explode ( string $delimiter , string
The type ServiceRegistryBuilder is deprecated
is deprecated What is the correct way of creating the SessionFactory in Hibernate
Function mysql_db_query() is deprecated
Function mysql_db_query() is deprecated  Hi, In latest version of PHP Function mysqldbquery() is deprecated. What could be the solution? Thanks
Function mysql_db_query() is deprecated
Function mysql_db_query() is deprecated  Hi, In latest version of PHP Function mysqldbquery() is deprecated. What could be the solution? Thanks
class with in its own objects?
class with in its own objects?  Is it a good idea to declare a class with in its own objects
datatypes in c++ and its sizes
datatypes in c++ and its sizes   What is mean by datatypes in C++ and what is the sizes of different datatypes
its urgent - Development process
its urgent  Hi how to write a program in core java , program is searching documents and contents in a existing folder or upload a folder or download a folder ,but important thing is how to search the contents
Storage medium that loses its contents
Storage medium that loses its contents  A Storage medium that loses its contents in the events of power failure is called? 1. Volatile storage 2. Non volatile storage 3. Permanent storage 4. All of the above 5. None
Conversion of unicode to its corresponding character
Conversion of unicode to its corresponding character  i have a string of unicodes e.g String s="\c0059\c0049\c3000" .. i need code for converting these unicodes to its corresponding alphabets.. pls if possible rep asap as i need
Modifying Text by Replacement
Modifying Text by Replacement     ...("Girish Tewari"):-Modify the text by Replacement Xml code...;@Program that Modify Text by Replacement  
its urgent for me - Development process
its urgent for me  Hi All, this is kalavathi,i am new to alfresco.present i am using alfresco3.9b version.my problem is i was writing code in java using alfresco.it is not working and i am not able to understand what
Edit Text by Insertion and Replacement
Edit Text by Insertion and Replacement   ... the Text in a DOM document. Methods which are used for insertion and replacement...;that Edit Text by Insertion and Replacement
write a program to demonstrate wrapper class and its methods......
write a program to demonstrate wrapper class and its methods......  write a program to demonstrate wrapper class and its methods
why java file save as its class name
why java file save as its class name  hi,this is subbareddy vajrala.my doubt is why java files save as its class names
ABUT A FUNCTION AND ITS USE - Java Beginners
ABUT A FUNCTION AND ITS USE  SIR CAN U PLEASE TELL ME ABOUT parseInt(args[i]) a)its use? b)when it is used? C)is it related to string class
Logout if its not active for longer period in jsp
Logout if its not active for longer period in jsp  hi all, Please tell me how to log out the application if its not performing any activity... its not working please reply.. thanks in advance   Please visit
Difference in size of .java & its respective .class file
Difference in size of .java & its respective .class file  Hai, I had created & compiled a java class named sample.java. The size of sample.java is 340KB. Whereas the size of its respective class file sample.class is 137KB
its very urgent please help me
its very urgent please help me  how can i retrieve all images from ms access database and display in jsp pages
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
jpa one-to-many persist children with its ID
jpa one-to-many persist children with its ID  I have two tables like Organization and region ,both table having one to many relationship.when i persist the organization table it also persist to region . Here i Wont manually
unicode conversion to its actual text format
unicode conversion to its actual text format  hi, i am saving the hindi text into the database. It is saving in db as "हिन्डि". But while fetching i am not able to fetch the same hindi text
pls help its eating my time:(
pls help its eating my time:(  hi am new to struts2.0 in my application i have declared a list in static how to get the static list values in my result.jsp??? if i remove the static in the list the result is getting displayed.why
how to reverse a string without changing its place
how to reverse a string without changing its place  how to reverse a string without changing its place   Hi Friend, Another way of reversing string: import java.util.*; public class ReverseString{ public static
reply me its urgent - Java Beginners
reply me its urgent  Hi friends I am facing problem in my application in this type please help me i am using database mysql5.0 version...'@'localhost' (using password: YES)" please tell me what is the error....its
accepts the area of a square and will calculate its perimeter.
accepts the area of a square and will calculate its perimeter.  Develop a program that accepts the area of a square and will calculate its perimeter.   Hi Friend, Try the following code: import java.util.*; import
jpa one-to-many persist children with its ID
jpa one-to-many persist children with its ID  @Entity public class... can see from my annotaiton, When Item pesist, it will also persist its children. As composited ID has a very bad reputation and I realy need its parent's ID
pls help me sir its urgent
pls help me sir its urgent  thanks for reply, but i am getting this error pls help me its urgent type Exception report message description The server encountered an internal error () that prevented it from
help regarding variable types and its modifiers
help regarding variable types and its modifiers  static variable is initialized once only and can be used by all objects. i want static in sense of program execution i want to count how many times the said program is executed
according to me its ok but is calculating wrong values in
according to me its ok but is calculating wrong values in   program to calculate roman numbers .....i.e roman number calculator import java.util.*; import java.io.*; class romancalci { public static void main(String
jQuery image replacement by click or select
jQuery image replacement by click or select In this section, you will learn...; <HEAD> <TITLE> Image replacement by click </TITLE> <script... Replacement By&nbsp; Button Click</h1> <div> <p class="
Forward Log Records to Its Parent
Forward Log Records to Its Parent   ... to its parent. You know that a logger sends both log records (messages declared... and this provides facility to forward log records to its parent. But it resumes
jpa one-to-many persist children with its ID by EntityListeners
jpa one-to-many persist children with its ID by EntityListeners  jpa one-to-many persist children with its ID by EntityListeners
auto log out the application if its inactive for longer period
auto log out the application if its inactive for longer period  hi all, Please tell me how to auto log out the application if its not performing any...(arg0); but still its not working please reply.. thanks in advance
HTTP Status 405 - Request method 'GET' not supported. Its urgent
HTTP Status 405 - Request method 'GET' not supported. Its urgent  When I use window.open('/admin/provisionNodeSamlPost.do?actionType=metadataview... - Request method 'GET' not supported." Anybody reply ASAP, its urgent
how to configure apache tomcat for eclipse when already its used by netbeans
how to configure apache tomcat for eclipse when already its used by netbeans  How to configure Apache tomcat for eclipse when already it's used... and eclipse in a same system. I have tried it but its not working if some one could
JAVA Code for Getting List of Directories and its SubDirectories from FTP server
JAVA Code for Getting List of Directories and its SubDirectories from FTP server  **Hi. I am trying to get list of all directories and sub directories and its files from "FTP" and want to show in Jtree but i am unable to do
The app was not installed on iphone because its resources have been modified
The app was not installed on iphone because its resources have been modified  Hi, I am getting following error while my client is installing my AdHoc build on his iPhone: "The app was not installed on iphone because its
Fetch Gmail Contacts through its service - Java Beginners
Fetch Gmail Contacts through its service  Hello All i want to fetch gmail contacts through there web service in java how can i do. please give me sample code .. Thanking You... Vikram
Plz reply me sir Its urgent - JSP-Servlet
Plz reply me sir Its urgent  Respected Sir/madam, I am R.Ragavendran..Actuaaly,I request you to remember the code which you have provided for me using radio buttons.. You have used the following syntax for checking whether
GUI Interface .Reply me with in hour..Its Urgent - Java Beginners
GUI Interface .Reply me with in hour..Its Urgent  Hi ... Now i am doing project for Voting finger print Authentication .. Can any pls assit me.. I have to create GUI Interace ..How should i create the Interface. In Existing
Using the Captured Text of a Group within a Replacement Pattern
Using the Captured Text of a Group within a Replacement Pattern       In this section, you will learn how to use the captured text from the group of the text. This section
 

 

 

DMCA.com