-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate concerns of an Oracle Database Administrator
PostPosted: Mon Mar 08, 2004 9:36 pm 
Newbie

Joined: Mon Mar 08, 2004 9:18 pm
Posts: 2
Hi all,

One of the developers in my team has requested I take a look at Hibernate and let him know what I think. From what I've seen so far it looks like a perfect tool for databases such as MySql and Postgress.

But for Oracle I have concerns that it gives developers too much power.
For example.. suppose a developer asks me to create a table and then he/she subsequently implements constraint checking using Hibernate. If I go and make changes to the table myself using my own scripts I'm likely to break this table because I'm not aware the constraint exists.

I'm of the belief that as much database related code should be kept on the database as possible... Firstly on the table level and if that can't be done then using a PL/SQL Stored Procedure then a Oracle Java Stored Procedure then finally in the application if all else fails. This is as much for performance reasons as it is for good practice. I'm curious to know what everyone thinks of this.

Another concern I have is with performance tuning. If I'm seeing a great performance hit will it be enough to simply look at my developer's code when I try to optimise or will I need to look deep into the mechanics of Hibernate?

I may have further questions but that will do for now. thanks in advance.

Ben


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 11:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
For example.. suppose a developer asks me to create a table and then he/she subsequently implements constraint checking using Hibernate. If I go and make changes to the table myself using my own scripts I'm likely to break this table because I'm not aware the constraint exists.


Actually it is usual for Hibernate to delegate constraint checking to the database. We assume that the DB itself implements foreign key, unique, check constraints, etc.

Indeed, if you use Hibernate to generate the DDL (you don't have to do this) then you can indicate the correct unique and check constraints in the mapping file and they will be included in the DDL (foreign keys are added automatically).

Of, of course, you can simply write the DDL yourself and add triggers etc.

Quote:
Another concern I have is with performance tuning. If I'm seeing a great performance hit will it be enough to simply look at my developer's code when I try to optimise or will I need to look deep into the mechanics of Hibernate?


Usually you would look at the generated SQL, and then figure out what changes should be made to the Hibernate query (this is usually very easy). In a pinch, you can just modify the SQL directly and use Hibernate's support for native SQL queries.

We usually advise people to use named queries (ie. queries in metadata) when they are working in an environment with a proactive DBA. That way, all query tuning can be done by meddling with just the XML metadata, no Java coding is needed.



You just reminded me of something that I mean to add to the TODO list:

I want the name of a named query to appear as a comment in the generated SQL, so that the DBA can easily find the HQL query in the metadata.

Actually, we should also add a setComment() method to Query interface, for the same purpose. I'll add this stuff today or tomorrow; its very useful, I think.

P.S. I should say that we are extremely receptive here to input from DBAs and we consider it absolutely critical that Hibernate addresses the concerns of people on the data side.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 12:14 am 
Newbie

Joined: Mon Mar 08, 2004 9:18 pm
Posts: 2
thanks Gavin that's a great help. It's also nice to see good Open Source contribution from here in Melbourne ;)

Ben


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 12:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Come to the EJV meeting on the 24th if you are in Melbourne and want to know more :)


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