Results 1 to 2 of 2
  1. #1
    esolve is offline Member
    Join Date
    Mar 2015
    Rep Power

    Default SchemaExport(Configuration) constructor is deprecated

    I'm using Hibernate 5

    Java Code:
    package cn.itcast.util;
    import org.hibernate.cfg.Configuration;
    import org.hibernate.tool.hbm2ddl.SchemaExport;
    public class ExportDB {
        public static void main(String[] args) {
            //read hibernate.cfg.xml
            Configuration cfg = new Configuration().configure();
            SchemaExport export = new SchemaExport(cfg);
            export.create(true, true);
    when I run the above code, it says the constructor is deprecated

    but I see from the "Referenced Library" that there is "SchemaExport(Configuration)" constructor

    SchemaExport(Configuration) constructor is deprecated-111.png

    so what is wrong?
    Last edited by esolve; 10-10-2016 at 05:38 PM.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    The Netherlands
    Rep Power

    Default Re: SchemaExport(Configuration) constructor is deprecated

    Nothing is wrong. It's deprecated. They encourage you to use a different way of constructing it. The JavaDocs are your friend here: SchemaExport (Hibernate JavaDocs)

    SchemaExport(Configuration configuration)
    Use one of the forms accepting MetadataImplementor, rather than Configuration, instead.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 5
    Last Post: 08-11-2012, 10:50 AM
  2. Deprecated warnings?
    By Josep_16 in forum Java Applets
    Replies: 1
    Last Post: 08-07-2011, 01:52 AM
  3. deprecated API error
    By guru_boy in forum New To Java
    Replies: 4
    Last Post: 05-06-2009, 08:37 AM
  4. deprecated method.. help!
    By iuna in forum Java Applets
    Replies: 11
    Last Post: 09-08-2008, 09:38 PM
  5. I need help with a deprecated program
    By mikau in forum New To Java
    Replies: 0
    Last Post: 02-13-2008, 10:34 AM

Posting Permissions

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