• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping issues when migrating from Hibernate 4.3 to 5.0.2.final

 
Shai Lurie
Greenhorn
Posts: 3
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When run the code with the new hibernate I got "org.hibernate.UnknownEntityTypeException: Unable to locate persister".

I understand that mapping via the cfg.xml file ( <mapping class="com.example.classname"/> is not supported anymore.
However I couldnt find any documentation for the alternative (and I belive that mapping is not the only thing which is disabled.

Has anyone solved this issue?

My current conf file is:

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shai Lurie,

First of all, a warm welcome to CodeRanch!

Shai Lurie wrote:Has anyone solved this issue?

Did you already read the migration guide?

Hope it helps!
Kind regards,
Roel
 
Shai Lurie
Greenhorn
Posts: 3
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel,
The guide didnt help, but I figure it out.
Thank a lot
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shai Lurie wrote:The guide didnt help, but I figure it out.

And can you share the solution/fix you applied? That could be very helpful for other racnhers facing a similar issue.
 
Shai Lurie
Greenhorn
Posts: 3
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED!
Apparently mapping throw the configuration file are not possible any more (mapping_class properties are ignored).
The way I found to define the mapping is in the code when creation the session factory:



2 More things:
1. properies can be added to the configuration programmatically using:

2.
default_schema property doesnt work any more (probably ignored). In 5.0 the database shout be concatenated to the url property:

Old Configuration:


New Configuration:


 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear you have solved the issue. Have a cow for coming back and sharing the solution! Might be helpful to other ranchers having a similar problem

PS. Always use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers. I've gone ahead and added the code tags for you. See how much easier the code is to read?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic