-->
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: Help on mapping a time table
PostPosted: Tue May 17, 2005 8:02 pm 
Newbie

Joined: Fri May 13, 2005 11:02 am
Posts: 4
Hi!
I need some assistance on the following problem. I'll explain the scenario in brief.

I have mapped an Employee-table to Employee java objects and a Project table to Project java objects. Simple enough. In the MySQL database, the two tables are joined using a TimeTable table to describe the amount of hours an employee have worked on a project on a specific date. TimeTable looks like this:
Code:
FIELD           TYPE            KEY
PRJ_InternalID  int(11)         PRI
EMP_InternalID  int(11)         PRI
ActualDate      varchar(8)      PRI
Hours           double

To model this in Java, I would prefer to make a class called RegisteredWork which contain a reference to a Project, a date and the amount of hours worked, and then let each Employee object contain a Collection (Set or whatever) of RegisteredWork objects.
Brief sketch of the classes:
Code:
class Employee
{
   int id;
   String name, etc;
   SortedSet timeTable; //contains RegisteredWork objects

   public void setTimeTable( SortedSet timeTable )
   {
      this.timeTable = timeTable;
   }

    //more getters/setters
}

class Project
{
   int id;
   String projectname, etc;

    //getters/setters
}

classRegisteredWork
{
    Project project;
    GregorianCalendar date;
    double hours;
}

About the date which is stored in TimeTable as VARCHAR, I have a working usertype for that.

Now, is this possible to map in Hibernate? I'm already familiar with many-to-many relations using SortedSet eliminating the need for a Java object for the join table, but I'm having some trouble solving this one.

I hope I have provided enough info, and any help is appreciated!

Best regards,
Rune


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.