-->
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 mapping documentatiin and SQL statements
PostPosted: Sat Apr 22, 2006 4:20 pm 
Newbie

Joined: Sat Apr 22, 2006 4:12 pm
Posts: 2
Hi , I would like to see exactly what kind of SQL statements will be executed when you use a mapping attribute in the hibernate documentation. it does not make any sense to exlain meaning of attributes like one-to-many or fetch="join" or lazy="true" without showing the kind of sql statements that are expected to be executed. We have to completely execute stuff to know what it is going to do. Every Attribute MUST be explined with EXACT SQL STATEMENT THAT IS GOING TO BE GENERATED. Document is totally OBSCURE without this- Thanks

_________________
Raghu


Top
 Profile  
 
 Post subject: Re: Hibernate mapping documentatiin and SQL statements
PostPosted: Sun Apr 23, 2006 11:39 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
rsapre wrote:
Hi , I would like to see exactly what kind of SQL statements will be executed when you use a mapping attribute in the hibernate documentation. it does not make any sense to exlain meaning of attributes like one-to-many or fetch="join" or lazy="true" without showing the kind of sql statements that are expected to be executed. We have to completely execute stuff to know what it is going to do. Every Attribute MUST be explined with EXACT SQL STATEMENT THAT IS GOING TO BE GENERATED. Document is totally OBSCURE without this- Thanks


hello friend,
what you are asking about is impossible because Hibernate is an abstract O/R-layer. The SQL being generated depends on the dialect.
Also the rendering of the SQL-statement is a complex-process, it's impossible to give a 1:1 representation.
If you need total control use SQL instead of HQL.
Hope that helps.

_________________
Please don't forget to give credit, if my posting helped to solve your problem.


Top
 Profile  
 
 Post subject: About Documentation
PostPosted: Sun Apr 23, 2006 9:58 pm 
Newbie

Joined: Sat Apr 22, 2006 4:12 pm
Posts: 2
Thanks. ok.
Probably for immediate concern I should search fetch="join|select" in forum.

The rest are just my thoughts or about documentation.
I would like documentation to discuss which arise when you use hibernate in a particular way.

I am expecting too much from documentation probably,
I can understand difficulty to write documentation to address all the
concerns and the difficulty to give all sql statements.
(You can provide in one dialect and one use case which can not cover every aspect )
But some consequence are almost immediate which will clarify things a lot
e.g.
1) Lazy attribute and immediate concerns like
a) lazyInitialization error,
b) how to achieve control over loading differnt child tables for the same parent in different cases
2) many-to-many mapping and NonUniqueObjectException
3) fetch attribute and its consequence on generated sql ( I am still trying to figure out this)
This will help people understand and use hibernate in the correct way and if any limitation will become clear early.

You will get LazyInitialization Exception if you specify Lazy="true" and do not run the iterator when you fetch the data can be mentioned in the place where meaning of lazy attribute is explained the first time itself.
Or I am still wondering the difference between fetch="join" and fetch="select" for many-to-one an this when I am not a novice to SQL or to Java or to hibernate. if you provide 2 sql statements what happens with fetch="join" and with fetch="select" would clarify more.

Even many-to-many mapping should bring up the issue of
NonUniqueObject exception in the place where many-to-may mapping is explained. Because the related stuff can get loaded multiple times and when one of them is updated can cause this kind of situation.

I have used hibernate for more than a year and have found that the generated sql statements are good(in terms of explain plan) .

It is only the granularity which needs more control which is hard to visualize by merely reading hibernate documentation.
i.e normally the relations between database tables are static and one has fine control over which SQL statement to execute. Hibernate tries to use static O/R mappings in a dynamic manner to generate sql statements e.g. you may want to run one iterator for one child Table in one case and not in another case. I would have appreciated this concern and expected usage mentioned in the place where lazy attribute is mentioned.

Also e.g. <many-to-one lazy="false"> query to fetch parent is getting executed in many-to-one case and hibernate3 is not allowing to prevent it from getting exeucted. You can not set lazy attribute to false. I think developers at hibernate have these as known issues or already resolved only they do not appear in the documentation where I would like to see these mentioned.

_________________
Raghu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 1:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
read Hibernate In Action

_________________
Max
Don't forget to rate


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.