-->
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.  [ 5 posts ] 
Author Message
 Post subject: Can I use Hibernate 4 an existing database?
PostPosted: Thu Apr 29, 2004 4:13 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
Hi,

I've read some topics about Hibernate, but It's not clear to me, whether I can use Hibernate for an existing database schema.

We need to migrate an old system to J2EE enviroment. we can't change the database schema, but we can change the application logic.

So we have a lot of tables, complex selects and inserts.
We wan't to design new Java objects, and map them to these given tables.

Is it possible?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 4:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Theoretically it is of course possible. But you have to experiment with hibernate a little if your table structure is mappable. If you have very "non-normal-form" tables, you might run into problems, even though Hibernate can really handle a lot. But especially overly complex composite key scenarios and such things may be difficult to map (though not necessarily impossible).

So alltogether: Yes, possible, but you have to do some prototyping first. You could also take a look at midlegen to take the "from the database upwards" approach.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 4:19 pm 
Newbie

Joined: Thu Apr 15, 2004 12:00 pm
Posts: 13
Yes. U can use existing schema. Hibernate supports most of the database operations. For detail information please see documentation(http://www.hibernate.org/5.html)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 4:46 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
michael wrote:
Theoretically it is of course possible. But you have to experiment with hibernate a little if your table structure is mappable. If you have very "non-normal-form" tables, you might run into problems, even though Hibernate can really handle a lot. But especially overly complex composite key scenarios and such things may be difficult to map (though not necessarily impossible).

So alltogether: Yes, possible, but you have to do some prototyping first. You could also take a look at midlegen to take the "from the database upwards" approach.



Thank you for your reply.
I'm quite new to Hibernate. The existing database we have was designed by database professionals. I haven't overviewed the schema, but I believe it's quite normalized, and have no anomalies.

But as we'll create Java objets, probably it won't fit perfectly to the tables. The following situations may occur:
the object has more attributes then the mapped table OR
the object has fewer attrributes OR
Object mapping to multiple tables will be neded (again, we can't change the existing DBS schema)

Do you think that Hibernate can handle this?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Yes, with varying degrees of work you have to do yourself.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.