-->
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.  [ 9 posts ] 
Author Message
 Post subject: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 10:00 am 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
I am trying to integrate my java play application with hibernate orm and here is my project structure.

Image

As you can see, I have placed my pojos inside a package named models and hibernate.cfg.xml inside conf.

hibernate.cfg.xml

Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/db_name</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">password</property>
        <property name="show_sql">true</property>
        <property name="format_sql">true</property>
        <property name="hibernate.enable_lazy_load_no_trans">true</property>

        <mapping resource="models/Coating.hbm.xml"/>
        <mapping resource="models/Fitting.hbm.xml"/>
        <mapping resource="models/Product.hbm.xml"/>
        <mapping resource="models/ProductHasCoating.hbm.xml"/>
        <mapping resource="models/ProductHasFitting.hbm.xml"/>
        <mapping resource="models/ProductHasSize.hbm.xml"/>
        <mapping resource="models/Size.hbm.xml"/>

    </session-factory>
</hibernate-configuration>


HibernateUtil class : (inside services)

Code:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {

    private static final SessionFactory sessionFactory;

    static {
        try {
            // Create the SessionFactory from standard (hibernate.cfg.xml)
            // config file.
            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
        } catch (Throwable ex) {
            // Log the exception.
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}


Controller Class

Code:
public class LoginController extends Controller {

    public Result login() throws SQLException {
        Session s = HibernateUtil.getSessionFactory().openSession();
        Criteria c = s.createCriteria(Coating.class);
        c.add(Restrictions.eq("code", "CO3444"));
        Coating co = (Coating) c.uniqueResult();
        String title = co.getTitle();
        s.close();
        return ok(views.html.login_page.login.render(title));
    }
}


Everything seems fine for me and once I compile and run the application, It terminates the application server with below error.

Code:
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource models/Coating.hbm.xml
Uncaught error from thread [play-dev-mode-akka.actor.default-dispatcher-4]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[play-dev-mode]
java.lang.ExceptionInInitializerError
        at services.HibernateUtil.<clinit>(HibernateUtil.java:18)
        at controllers.LoginController.login(LoginController.java:15)
        at router.Routes$$anonfun$routes$1.$anonfun$applyOrElse$2(Routes.scala:164)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:82)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction.$anonfun$apply$8(JavaAction.scala:132)
        at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
        at scala.util.Success.$anonfun$map$1(Try.scala:251)
        at scala.util.Success.map(Try.scala:209)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete(Promise.scala:368)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete$(Promise.scala:367)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.onComplete(Promise.scala:375)
        at scala.concurrent.impl.Promise.transform(Promise.scala:29)
        at scala.concurrent.impl.Promise.transform$(Promise.scala:27)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.transform(Promise.scala:375)
        at scala.concurrent.Future.map(Future.scala:287)
        at scala.concurrent.Future.map$(Future.scala:287)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.map(Promise.scala:375)
        at scala.concurrent.Future$.apply(Future.scala:653)
        at play.core.j.JavaAction.apply(JavaAction.scala:132)
        at play.api.mvc.Action.$anonfun$apply$2(Action.scala:96)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:174)
        at scala.util.Try$.apply(Try.scala:209)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:174)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:218)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:217)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:403)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:400)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:207)
        at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:298)
        at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:255)
        at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:201)
        at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:107)
        at akka.stream.impl.fusing.MapAsync$$anon$24.onPush(Ops.scala:1191)
        at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512)
        at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475)
        at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371)
        at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:584)
        at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:468)
        at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:559)
        at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:741)
        at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:756)
        at akka.actor.Actor.aroundReceive(Actor.scala:517)
        at akka.actor.Actor.aroundReceive$(Actor.scala:515)
        at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:666)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
        at akka.actor.ActorCell.invoke(ActorCell.scala:496)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource models/Coating.hbm.xml
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3764)
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3753)
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3741)
        at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
        at services.HibernateUtil.<clinit>(HibernateUtil.java:14)
        ... 71 more
Caused by: org.hibernate.MappingException: class models.Coating not found while looking for property: id
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:233)
        at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:362)
        at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:453)
        at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:386)
        at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:326)
        at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:177)
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3761)
        ... 77 more
Caused by: java.lang.ClassNotFoundException: models.Coating
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:193)
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)
        ... 83 more


UPDATED

But once I remove all the mappings from hibernate.cfg.xml and change the LoginController code to below :

Code:
Session s = HibernateUtil.getSessionFactory().openSession();
        Connection c = s.getSessionFactory().getSessionFactoryOptions().getServiceRegistry()
                .getService(ConnectionProvider.class).getConnection();

        //Criteria c = s.createCriteria(Coating.class);
        //c.add(Restrictions.eq("code", "CO3444"));
        //Coating co = (Coating) c.uniqueResult();
        //String title = co.getTitle();
        //s.close();
        String title = c.getMetaData().getDatabaseProductName();
        return ok(views.html.login_page.login.render(title));


Application starts and runs fine in the browser with the output of MySQL Which means there is no any hibernate configuration errors and no any errors with the HibernateUtil class either.

Any help would be appreciable. Thank you.


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 1:17 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I see you declared:

Code:
<mapping resource="models/Coating.hbm.xml"/>


So, you will have to debug it to see why it is not applied. Try to see if the hibernate.cfg.xml is loaded during the bootstrap time.


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 1:32 pm 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
@vlad please check the updated section of my question , if the hibernate.cfg.xml is not loaded I wont get the mentioned output after executing the controller code.

Code:
       Session s = HibernateUtil.getSessionFactory().openSession();
        Connection c = s.getSessionFactory().getSessionFactoryOptions().getServiceRegistry()
                .getService(ConnectionProvider.class).getConnection();

        //Criteria c = s.createCriteria(Coating.class);
        //c.add(Restrictions.eq("code", "CO3444"));
        //Coating co = (Coating) c.uniqueResult();
        //String title = co.getTitle();
        //s.close();
        String title = c.getMetaData().getDatabaseProductName();
        return ok(views.html.login_page.login.render(title));


Gives me the output MYSQL


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 1:41 pm 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
@vlad I was thinking the same thing like you do and I replace the hibernate.cfg.xml like below :

Code:
Configuration configuration = new Configuration()

                    .addResource("models/Coating.hbm.xml")
                    .addResource("models/Fitting.hbm.xml")
                    .addResource("models/Product.hbm.xml")
                    .addResource("models/Size.hbm.xml")
                    .addResource("models/ProductHasSize.hbm.xml")
                    .addResource("models/ProductHasCoating.hbm.xml")
                    .addResource("models/ProductHasFitting.hbm.xml")
                    .setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/db_name")
                    .setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver")
                    .setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect")
                    .setProperty("hibernate.connection.username", "root")
                    .setProperty("hibernate.connection.password", "password")
                    .setProperty("show_sql", "true")
                    .setProperty("format_sql", "true")
                    .setProperty("hibernate.enable_lazy_load_no_trans", "true");

            ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
                    .applySettings(configuration.getProperties())
                    .build();

            Thread.currentThread().setContextClassLoader(Coating.class.getClassLoader());

            sessionFactory = configuration.buildSessionFactory(serviceRegistry);


But again I got the mapping exception but a little different from the previous one :

Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: class models.Coating not found while looking for property: id
Uncaught error from thread [play-dev-mode-akka.actor.default-dispatcher-4]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[play-dev-mode]
java.lang.ExceptionInInitializerError
        at services.HibernateUtil.<clinit>(HibernateUtil.java:47)
        at controllers.LoginController.login(LoginController.java:17)
        at router.Routes$$anonfun$routes$1.$anonfun$applyOrElse$2(Routes.scala:164)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:82)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction.$anonfun$apply$8(JavaAction.scala:132)
        at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
        at scala.util.Success.$anonfun$map$1(Try.scala:251)
        at scala.util.Success.map(Try.scala:209)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete(Promise.scala:368)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete$(Promise.scala:367)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.onComplete(Promise.scala:375)
        at scala.concurrent.impl.Promise.transform(Promise.scala:29)
        at scala.concurrent.impl.Promise.transform$(Promise.scala:27)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.transform(Promise.scala:375)
        at scala.concurrent.Future.map(Future.scala:287)
        at scala.concurrent.Future.map$(Future.scala:287)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.map(Promise.scala:375)
        at scala.concurrent.Future$.apply(Future.scala:653)
        at play.core.j.JavaAction.apply(JavaAction.scala:132)
        at play.api.mvc.Action.$anonfun$apply$2(Action.scala:96)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:174)
        at scala.util.Try$.apply(Try.scala:209)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:174)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:218)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:217)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:403)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:400)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:207)
        at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:298)
        at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:255)
        at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:201)
        at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:107)
        at akka.stream.impl.fusing.MapAsync$$anon$24.onPush(Ops.scala:1191)
        at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512)
        at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475)
        at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371)
        at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:584)
        at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:468)
        at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:559)
        at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:741)
        at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:756)
        at akka.actor.Actor.aroundReceive(Actor.scala:517)
        at akka.actor.Actor.aroundReceive$(Actor.scala:515)
        at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:666)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
        at akka.actor.ActorCell.invoke(ActorCell.scala:496)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.hibernate.MappingException: class models.Coating not found while looking for property: id
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:212)
        at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:437)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSimpleEntityIdentifier(ModelBinder.java:719)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityIdentifier(ModelBinder.java:343)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:238)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:185)
        at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)
        at services.HibernateUtil.<clinit>(HibernateUtil.java:42)
        ... 71 more
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [models.Coating]
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:229)
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:208)
        ... 84 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : models.Coating
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:217)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226)
        ... 85 more


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 3:42 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The problem is that you are not really using the mapping you set on Configuration, which you can remove anyway and just use StandardServiceRegistryBuilder to set the mappings and the properties:

Code:
final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder(bsr)
   .applySetting("hibernate.connection.url", "jdbc:mysql://localhost:3306/db_name")
   .applySetting(...)
   .applySetting(...)
   .build();
   
metadataSources.addResource("models/Fitting.hbm.xml");
metadataSources.addResource(...);
metadataSources.addResource(...);

final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();

MetadataImplementor metadata = (MetadataImplementor) metadataBuilder.build();

final SessionFactoryBuilder sfb = metadata.getSessionFactoryBuilder();

sessionFactory = sfb.build();


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 7:27 pm 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
@vlad sorry dude. :( Still giving me the exact same error. I changed everything as you requested but still no luck. :(


Changed code


Code:
StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
                    .applySetting("hibernate.connection.url", "jdbc:mysql://localhost:3306/database")
                    .applySetting("hibernate.connection.driver_class", "com.mysql.jdbc.Driver")
                    .applySetting("hibernate.dialect", "org.hibernate.dialect.MySQLDialect")
                    .applySetting("hibernate.connection.username", "root")
                    .applySetting("hibernate.connection.password", "password")
                    .applySetting("show_sql", "true")
                    .applySetting("format_sql", "true")
                    .applySetting("hibernate.enable_lazy_load_no_trans", "true")
                    .build();

            MetadataSources metadataSources = new MetadataSources();
            metadataSources.addResource("models/Coating.hbm.xml");
            metadataSources.addResource("models/Fitting.hbm.xml");
            metadataSources.addResource("models/Product.hbm.xml");
            metadataSources.addResource("models/Size.hbm.xml");
            metadataSources.addResource("models/ProductHasSize.hbm.xml");
            metadataSources.addResource("models/ProductHasCoating.hbm.xml");
            metadataSources.addResource("models/ProductHasFitting.hbm.xml");


            final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder(serviceRegistry);
            MetadataImplementor metadata = (MetadataImplementor) metadataBuilder.build();

            final SessionFactoryBuilder sfb = metadata.getSessionFactoryBuilder();

            sessionFactory = sfb.build();



Error


Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: class models.Coating not found while looking for property: id
Uncaught error from thread [play-dev-mode-akka.actor.default-dispatcher-2]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[play-dev-mode]
java.lang.ExceptionInInitializerError
        at services.HibernateUtil.<clinit>(HibernateUtil.java:56)
        at controllers.LoginController.login(LoginController.java:17)
        at router.Routes$$anonfun$routes$1.$anonfun$applyOrElse$2(Routes.scala:164)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:82)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction.$anonfun$apply$8(JavaAction.scala:132)
        at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
        at scala.util.Success.$anonfun$map$1(Try.scala:251)
        at scala.util.Success.map(Try.scala:209)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete(Promise.scala:368)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete$(Promise.scala:367)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.onComplete(Promise.scala:375)
        at scala.concurrent.impl.Promise.transform(Promise.scala:29)
        at scala.concurrent.impl.Promise.transform$(Promise.scala:27)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.transform(Promise.scala:375)
        at scala.concurrent.Future.map(Future.scala:287)
        at scala.concurrent.Future.map$(Future.scala:287)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.map(Promise.scala:375)
        at scala.concurrent.Future$.apply(Future.scala:653)
        at play.core.j.JavaAction.apply(JavaAction.scala:132)
        at play.api.mvc.Action.$anonfun$apply$2(Action.scala:96)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:174)
        at scala.util.Try$.apply(Try.scala:209)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:174)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:218)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:217)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:403)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:400)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:207)
        at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:298)
        at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:255)
        at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:201)
        at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:107)
        at akka.stream.impl.fusing.MapAsync$$anon$24.onPush(Ops.scala:1191)
        at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512)
        at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475)
        at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371)
        at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:584)
        at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:468)
        at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:559)
        at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:741)
        at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:756)
        at akka.actor.Actor.aroundReceive(Actor.scala:517)
        at akka.actor.Actor.aroundReceive$(Actor.scala:515)
        at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:666)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
        at akka.actor.ActorCell.invoke(ActorCell.scala:496)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.hibernate.MappingException: class models.Coating not found while looking for property: id
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:212)
        at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:437)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSimpleEntityIdentifier(ModelBinder.java:719)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityIdentifier(ModelBinder.java:343)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:238)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:185)
        at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
        at services.HibernateUtil.<clinit>(HibernateUtil.java:45)
        ... 71 more
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [models.Coating]
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:229)
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:208)
        ... 83 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : models.Coating
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:217)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226)
        ... 84 more
[ERROR] [SECURITY][12/26/2017 04:50:47.283] [play-dev-mode-akka.actor.default-dispatcher-2] [akka.actor.ActorSystemImpl(play-dev-mode)] Uncaught error from thread [play-dev-mode-akka.actor.default-dispatcher-2]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[play-dev-mode]
java.lang.ExceptionInInitializerError
        at services.HibernateUtil.<clinit>(HibernateUtil.java:56)
        at controllers.LoginController.login(LoginController.java:17)
        at router.Routes$$anonfun$routes$1.$anonfun$applyOrElse$2(Routes.scala:164)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:82)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction.$anonfun$apply$8(JavaAction.scala:132)
        at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
        at scala.util.Success.$anonfun$map$1(Try.scala:251)
        at scala.util.Success.map(Try.scala:209)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete(Promise.scala:368)
        at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete$(Promise.scala:367)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.onComplete(Promise.scala:375)
        at scala.concurrent.impl.Promise.transform(Promise.scala:29)
        at scala.concurrent.impl.Promise.transform$(Promise.scala:27)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.transform(Promise.scala:375)
        at scala.concurrent.Future.map(Future.scala:287)
        at scala.concurrent.Future.map$(Future.scala:287)
        at scala.concurrent.impl.Promise$KeptPromise$Successful.map(Promise.scala:375)
        at scala.concurrent.Future$.apply(Future.scala:653)
        at play.core.j.JavaAction.apply(JavaAction.scala:132)
        at play.api.mvc.Action.$anonfun$apply$2(Action.scala:96)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:174)
        at scala.util.Try$.apply(Try.scala:209)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:174)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:218)
        at play.api.libs.streams.StrictAccumulator$$anon$1.apply(Accumulator.scala:217)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:403)
        at play.libs.streams.Accumulator$StrictAccumulator$1.apply(Accumulator.java:400)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
        at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:207)
        at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:298)
        at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:255)
        at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:201)
        at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:107)
        at akka.stream.impl.fusing.MapAsync$$anon$24.onPush(Ops.scala:1191)
        at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512)
        at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475)
        at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371)
        at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:584)
        at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:468)
        at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:559)
        at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:741)
        at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:756)
        at akka.actor.Actor.aroundReceive(Actor.scala:517)
        at akka.actor.Actor.aroundReceive$(Actor.scala:515)
        at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:666)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
        at akka.actor.ActorCell.invoke(ActorCell.scala:496)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.hibernate.MappingException: class models.Coating not found while looking for property: id
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:212)
        at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:437)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSimpleEntityIdentifier(ModelBinder.java:719)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityIdentifier(ModelBinder.java:343)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:238)
        at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:185)
        at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
        at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
        at services.HibernateUtil.<clinit>(HibernateUtil.java:45)
        ... 71 more
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [models.Coating]
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:229)
        at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:208)
        ... 83 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : models.Coating
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:217)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226)
        ... 84 more


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 8:31 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try asking the question on the Play framework forum too. It's a ClassLoading issue.


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Mon Dec 25, 2017 8:36 pm 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
Yep.. I already asked. But got no reply yet. Maybe the Christmas cause the delay. :) :) Anyway really appreciate your support.


Top
 Profile  
 
 Post subject: Re: Playframework 2.6.x integrating with hibernate mapping error
PostPosted: Tue Dec 26, 2017 8:19 am 
Newbie

Joined: Mon Dec 25, 2017 9:44 am
Posts: 6
Location: Sri Lanka
Glad to inform you that I found a solution for this issue. As @vlad suggested it is class loading issue of playframework.
So the hbm.xml should be placed inside conf directory in order to load together with hibernate.cfg.xml.

https://ibb.co/fsrEH6


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

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.