Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change Hypersonic DS to MySql DS

 
Andrei Mezin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Andrei Mezin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas why switching to MySQL broke the hibernate's mapping?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic