wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Change Hypersonic DS to MySql DS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Change Hypersonic DS to MySql DS" Watch "Change Hypersonic DS to MySql DS" New topic
Author

Change Hypersonic DS to MySql DS

Andrei Mezin
Greenhorn

Joined: Sep 27, 2011
Posts: 8
Hi,

I try to switch an existing (and well deploying) application to MySql instead of Hypersonic . After I follow all steps from JBoss tutorial my application fails in deploy saying:

org.hibernate.MappingException: An association from the table OLOLO refers to an unmapped class: com.trololo.pack.Class.

MySql DB for JBoss has become filled with the data. But my app's DB is empty. I guess it is something wrong with hibernate, right?

I have JBoss 4.2.3. In the /default/deploy dir I have 2 *-ds.xml files. One for the JBoss and another for my app. Please share your ideas what is wrong there? Any help is welcome.



Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

This does sound like something wrong with the schema you have defined to Hibernate. You said you app's database is empty. Does that mean that you are letting Hibernate create the scheme? Or do you already have a schema? If the former, post the source for the OLOLO (or class that represents this table) and com.trololo.pack.Class classes. If the latter, post the database schema for the OLOLO table.

Also, you might try running JBoss AS without your application deployed. This will ensure that you migration from Hypersonic to MySQL went OK for DefaultDS. After you have verified that that works, you can deploy your app and can work on its issues.


JBoss In Action
Andrei Mezin
Greenhorn

Joined: Sep 27, 2011
Posts: 8
Peter Johnson, thank you for the quick response.

Of course I tried to run JBoss without applications deployed. It started well and 7 tables were created in MySql DB for JBoss (jbossdb).

Before I switched from Hypersonic to MySql I had well deploying and well running application. It's DB schema (myappdb in MySql) was generated by Hibernate and had no problem. After I switched to MySql I tried to make deploy both on the old schema in MySql (myappdb was filled with data) and with empty one. The result was the same:

org.hibernate.MappingException: An association from the table OLOLO refers to an unmapped class: com.trololo.pack.ClassInterface.

OLOLO class has a set of OneInstance objects and a single field of OneInstance . OneInstance entity inherits com.trololo.pack.ClassInterface interface.





Andrei Mezin
Greenhorn

Joined: Sep 27, 2011
Posts: 8
Any ideas why switching to MySQL broke the hibernate's mapping?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

It's DB schema (myappdb in MySql) was generated by Hibernate and had no problem. After I switched to MySql

I don't understand this. Are you saying that you always use MySQL for the database for your app, even before you changed DefaultDS to use MySQL?

Are you using the same MySQL database for your app and for JBoss AS? If so, have you tried using different database within MySQL?
Andrei Mezin
Greenhorn

Joined: Sep 27, 2011
Posts: 8
Peter Johnson,

In the very beginning I had DefaultDS for Hypersonic and XDS for MySql. I tried to switch DefaultDS from Hypersonic to MySql and use two DS and two databases.


Finally, I got the solution. For the unknown reason Hibernate didn't allow to mention com.trololo.pack.OneInstance in cfg.xml for OLOLO class. After I set annotations it helped.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change Hypersonic DS to MySql DS
 
Similar Threads
problem in setting mySql as default database server
won't create tables with jaws.xml
Hypersonic vs MySQL
Need help urgent
Jboss 4.2.3 how to change the default datasource to oracle ?