This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shared mysql database

 
Johann Spitz
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a hibernate web application (Tomcat) that already features a user management (complete with userlevels etc). Now I want to create a new application that uses its own database schema *but* - is able to use the User data from the other application.

This way I wouldn't have to create yet another user management. Is something like this possible with hibernate/mysql? Is there a solution to this at all?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two schema's == two SessionFactories. But if your new schema uses the data in this 'user' schema, why is it not part of the same schema?
 
Johann Spitz
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two schema's == two SessionFactories. But if your new schema uses the data in this 'user' schema, why is it not part of the same schema?


Okay, i will need two SessionFactories if I want to use the old schema. Thanks, that may help!

But I don't really understand your second question. I built one application that has a full user management. Now I want to build a second, totally unrelated app, that pulls data from the first one - why should I want to mingle the two into one database?

The problem here seems to be that I need to add relationships to the User object. What if I would do something like


where Toys is a java.util.Set that is mapped to the user one-to-many I guess I wouldn't be able to do that, would I?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

totally unrelated app

What I mean is if these are truly unrelated, then the schemas would be completely seperate. If they were totally unrelated then the second one would use no data from the first. If they are not, then perhaps one schema is a more accurate way to model your data?

But your follow-up post suggests you want to export data from the existsing app into your new app - am I right? i.e. you have a table called table_a in schema 1 which has data you want to move to a table called table_a in schema 2? If that's the case, you might consider some backend export script rather than putting it in your app. Just a suggestion - you (obviously) have much better visibility of what your requirements are than I do.
[ April 05, 2005: Message edited by: Paul Sturrock ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic