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: Domain model mapping - efficiency question
PostPosted: Fri Jan 22, 2010 7:18 am 
Newbie

Joined: Fri Jan 22, 2010 7:04 am
Posts: 1
In my domain model class Component has a list of properties as follows:

Code:
public class Component {

private List<Property> properties = new ArrayList<Property>();

}

public class Property {
private String name;
private Object value;
}



The property values are either Floats or Strings. Of course if I create direct mapping for the class Property I have to specify the class for value attribute (I cannot leave it simply as Object). The application uses a lot of searches made to these properties (e.g. find components with weight property < 100). The question is which would be the best way to model these domain objects. Regarding efficiency it probably would be best if I had properties with String values in their own table and Float values in their own table. However following is bit cumbersome:

Code:
public class Component {

private List<StringProperty> stringValueProperties = new ArrayList<StringProperty>();
private List<FloatProperty> floatValueProperties = new ArrayList<FloatProperty>();

}

public class StringProperty {
private String name;
private String value;
}

public class FloatProperty {
private String name;
private Float value;
}



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.