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: Design Help.
PostPosted: Wed Apr 21, 2004 4:44 am 
Hi all folks ,

I want to ask about my design decision ,

There are people and roles at my project. People are like a inspectors , doing inspect and writing reports.
I have a table for inspections reports , for instance Inspections and there are details for these inspections.But all details are different.
One inspect is type1 , other type2 , other type3 , and etc.

When they save a inspection also they must save deatils.
Inspection bean is easy , time , people , inspector , place , city , etc.etc properties..
But how can I implement detail(s) bean ? I think that I write a bean for details and all details with all kinds (type1 , type2 , there will be many , etc..) can be subclasses of these bean.And at Inspection bean I do like this :

class Inspection {

private String inspector;
private String city;
private Date date;
......
....etc.etc..
private Detail _detail;

}

class Detail {
}

class DetailType1 extends Detail{
private String type1_special_field;
...etc.etc....
}

class DetailType2 extends Detail{
private int type2_special_field;
...etc.etc.
}

class DetailType3 extends Detail{
private long type3_special_field;
... etc.etc.
}

When I want to save Inspection and it's details , for instance type3 details ,

... start code ...

Inspection ix = new Inspection();
ix.setX(....);
ix.setEtc(...);

Detail detx = new Detail();
detx.setType3_special_field(...);
detx.setEtc(.....);

ix.setDetail(detx);

.... end code ...

I think I can use "Table Per Class" poliymorphism strategy , I can save details one table and when I read a Inspection I can get detail without sorry about detail type is which kind.
???

And when I show inspection and details how do I build a HQuery ?

I need some example mapping and code. I ' m begginer Hibernate user , now I ' m using with many-to-one , and all basic properties.No problem for them.I have read Hibernate doc and looked at forums.

If these are reply or so easy , please excuse me.

Thanks from now.

Mehmet ,


Top
  
 
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.