-->
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: One Class - Many dynamic Tables. How can I map it?
PostPosted: Thu Dec 04, 2003 9:16 am 
Newbie

Joined: Thu Dec 04, 2003 8:51 am
Posts: 3
For a GIS-Mapping application, Id like to generate an Hibernate mapping.
in run time .
The reason is that one class (Layer) may have many different attributes (LayerAttribute).

For example:
a Layer River has Name, m3, length, lineGeometry. They are saved in River's table.
a Layer Country has Name, m2, countryCode, polygonGeometry. They are saved in Contry's table.

The easy solution (to create a Country class and a River class, and map them) doesnt work. I need to has one class (Layer) whose instances could dynamically descover its properties (by its relationships with a LayerAttribute class). The reason is that I want to add or replace data to system without reboot it or create new classes.

Id like to get two instances of Layer (riever and country) which read their data from two diferent tables.

Classes are like this:
class Layer{
private Set layerAttribute;
}

class LayerAttribute{
String name;
Class dataType;
Object atributeInstance;
}

Can I change in runtime an Hibernate class mapping? Is it an Hibernate feature, or must i look for it in cglib?

Regards!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 10:01 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Once mapping is created, you cannot change it. But you can create a new one programmaticaly (build DOM objects), I can't remember the API, but it should be doable.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 11:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
In 2.1, we let you create mappings programmatically by manipulating the metamodel in the .mapping package.

You can access this stuff using Configuration.createMappings()


Top
 Profile  
 
 Post subject: MetaClass for Class' Instance.
PostPosted: Thu Dec 04, 2003 12:41 pm 
Newbie

Joined: Thu Dec 04, 2003 8:51 am
Posts: 3
Is this issue (programatic mapping) only for class, or for class's instances?

What I want to do is to create a mapping for an instance (river's layer) and link mapping's metaclass to this instance in Hibernate Session.

Is this possible now?

Must I wait for Hibernate 2.1?


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.