Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Too many join - issue with the HibernateMapping file
Too many join - issue with the HibernateMapping file [message #615523] Wed, 20 February 2008 18:53
Yigal Spinner is currently offline Yigal SpinnerFriend
Messages: 127
Registered: July 2009
Senior Member
I have a very complex EMF module (over 150 classes). All classes in the
model are extend of one of two basic types: Part or Part_Relation.
Part is an abstract class that identifies a generic part. Part_relation
associates part to other parts.
Example: A car engine is a "Part" of the Car assemble. The engine has
many parts in side it. Those parts are grouped by functionality, like
moving parts, common parts, and etc. So I have Engine_MovingPart_Rel
that relates any moving parts to the engine.

Basic relation:
|----------| |------------| |-------------|
| | Aggregation | | Association | |
| Engine |-------------->| Eng_Rel |------------->| Part |
| |* 1| |1 1| |
|----------| |------------| |-------------|

This way I can associate different parts to the engine.
The Engine_MovingPart_Rel extends the Eng_Rel and adds additional
attributes that makes the assemble.

|----------| |------------| |-------------|
| | Aggregation | | Association | |
| Engine |-------------->| Eng_MovePart------------->| Piston |
| |* 1| Rel |1 1| |
|----------| |------------| |-------------|

Piston expands "Part".
|----------| |------------| |-------------|
| | Aggregation | | Association | |
| Piston |-------------->| Piston_Rel |------------->| PistonRings |
| |* 1| |1 1| |
|----------| |------------| |-------------|
(and so on and on)

I generated the Hibernate mapping file using the Join option.
When I create a HibernateResource and load an Engine, and want to LAZY
load all the different Engine_REL, I get over 69 joins that is an over
flow in mySql and causes an exception (fail). I investigated the SQL
commands and found that hibernate wants to load the entire model and
does not do lazy loading of the relationships. The SQL join all the
relations with all the parts and relations between those parts and other
parts.

I tried the following:
1. I put the @Proxy attribute on the "Piston" parts, the result was
combined tables of all abstract classes and database table only on non
abstract classes (duplication of data). But the issue was still there
and the join fails with more then 61 joins)

2. I tries to use the cascade fetch(Lazy) annotation. Did not help.

Currently I use the fist option of generating the the hibernate mapping
file,but that creates only TWO tables in the Database with all
attributes in them and the need for over 64 indexes which is not support
either. The join issue does not exists and I can run my application.
However a flat database is not acceptable and I have no indexes.

Any solution?

Thanks
Yigal
Previous Topic:resource
Next Topic:HbResourceImpl
Goto Forum:
  


Current Time: Sat Apr 27 02:53:05 GMT 2024

Powered by FUDForum. Page generated in 0.03371 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top