-->
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: Mapping interfaces
PostPosted: Tue Apr 20, 2004 9:14 am 
Newbie

Joined: Tue Apr 20, 2004 9:13 am
Posts: 2
Location: Mauritius
Hi,

I have the following interfaces and classes.

Code:
interface Instruction {
   
   public String getId();
   
   public String getDescription();
   public void setDescription(String description);
   
   public Collection getUnits();
   public void addUnit(Unit unit);
   public void removeUnit(Unit unit);
   
   ...
}

interface Unit {
   
   public String getId();
   
   ...
}

class InstructionImpl implements Instruction {
   
   private String id;
   private String description;
   
   public InstructionImpl() {}
   
   public InstructionImpl(String description) {
      this.description = description;
   }
   
   public String getId() {
      return id;
   }
   
   ...
}

class UnitImpl implements Unit {
   ...
}


The existing table structure is:

Code:
create table INSTRUCTION (
   id VARCHAR(32) NOT NULL PRIMARY KEY,
   description VARCHAR(255) NOT NULL
)

create table UNIT (
   id VARCHAR(32) NOT NULL PRIMARY KEY,
   description VARCHAR(255) NOT NULL
)


What kind of mapping can I use, given that I need a one-to-many relationship between Instruction and Unit, therefore, making table-per-concrete-class not an option? I also cannot modify the table structure.

Thanks in advance.


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.