-->
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.  [ 1 post ] 
Author Message
 Post subject: Quesiton about mapping a Map on multiple entities to 1 table
PostPosted: Tue Nov 29, 2005 7:23 pm 
Newbie

Joined: Thu Sep 16, 2004 8:56 pm
Posts: 3
Hibernate version: 3.0

I'm trying to find a way to map multiple classes with a Map property to a single lookup table with Hibernate, and I think I'm just missing something simple but I can't get it to work as I expect.

What I would have are a couple of classes like

Code:
class my.Foo {
  Map<String,String> meta;
}

class my.Bar {
  Map<String,String> meta;
}


and my goal is to be able to use a single Map table like

Code:
create table meta {
  varchar(255) clazz,
  varchar(128) mkey,
  varchar(255) mvalue,
  primary key (clazz,mkey)
}


where the clazz column is meant to hold the class discriminator values "my.Foo" and "my.Bar". I was hoping Hibernate could be configured to automatically populate the clazz column with the property's parent class name and thus present a simple Map<String,String> from the application's point of view.

Is there a simple way to accomplish this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.