-->
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: Hibernate ORM Annotation for HashMap
PostPosted: Mon Jul 08, 2013 5:45 pm 
Newbie

Joined: Mon Jul 08, 2013 5:28 pm
Posts: 1
I have question on ORM. I have two tables and want to create one object- java class based on them. I have specific requirement to write class in below fashion.

Table: ComputerFranchise
Fields:
id - number (primary key)
address - varchar2


ComputerType
Fields:
computerName: varchar2
compFranchiseId: number (foreign key referencing to id of computerFranchise)
dailySales: number



Based on above tables i want to create single java class with below fileds and methods.

@Entity
public class ComputerFranchise
{

@Id
int id;
public int getId(){..}
public void setId(int id){..}

@Column
String address;
public String getAddress(){}
public void setAddress(String add){..}


HashMap dailysales<String,Integer> - This is hashmap of computertype mapped to thier daily sales per franchise, and should be sorted by computername. What annotations should i use to create this hashmap and here real question is i don's want to create javaclass for ComputerType?
Should i use secondary table concept or should i use read only query or is there better to create this field?

public HashMap getDailySales()
{
..
}

public void setDailySales(HashMap map)
{
...
}

}


So question is best way to create dailysales hasmap filed and operation on it. How should i map this filed to table and what annotations should i use?

Thanks in advance for any suggestions/pointers.


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.