473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

one to many implementation in java

Hi all,

I have a question it may sound pretty naive to all of you guys but i am trying it from last 2 days.

I am trying to implement one-to many relationship using hibernate below is my mapping file
Expand|Select|Wrap|Line Numbers
  1. <class name="ManagerDTO" table="Manager">
  2. <id name="managerId" type="int" column="manager_id"> <generator class="native"/></id>
  3. <set name="managerToEmployee" cascade="all" inverse="true">
  4. <key column="manager_ide"/>
  5. <one-to-many class="EmployeeDTO"/>
  6. </set>
  7. <property name="managerName" type="string" column="manager_name" length="255" not-null="true"/>
  8. </class>
  9. <class name="EmployeeDTO" table="Employee">
  10. <id name="emploeeId" type="int" column="employee_id"> <generator class="native"/></id>
  11. <property name="employeeName" type="string" column="employee_name" length="255" not-null="true"/>
  12. <many-to-one name="managerToEmployee" column="manager_ide" lazy="false" class="ManagerDTO"/>
  13. <!--<many-to-one name="enrolledDTO" column="sectionId"  lazy="false" class="SectionDTO" fetch="join"/> -->  
  14.  
  15. </class>
i need a query which will select all the managers and employees work for them

which collection set i can use for it?

can i do it in one query or first i have to get all the managers and then get emplyees one by one for each manager and store them in a list.

i think i can do it with hash table where manager will be the key representing all the employee belongs to him.. but i doono how to implement it.

can someone please give me some direction and the query?
Jul 6 '09 #1
0 1267

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jenniferyiu | last post by:
IMHO, simply NO. False actually, practically.
3
by: Gert Schumann | last post by:
I'm operating on sun OS 5.6 I ping a host every 10 seconds to get knowlegde wheather it is running or not. After about one and a half hour I get this Exception: java.io.IOException: Too many open...
6
by: Paul Fame | last post by:
Hello World, This is not a flame, but a question about the fundamentals of the language. Unlike some languages, C++ requires class member functions to be declared twice: once in the class...
9
by: Steven T. Hatton | last post by:
This was written for the gnu.g++.help list. It rather clearly spells out the most important feature of Java that I believe C++ lacks. I really don't believe the C++ Standard sepcifies enough for a...
0
by: yccheok | last post by:
I try to write a c implementation of java abstract class which serve the same purpose. however, I feel that there might be some potential holes in the future especially when I plan to scale up this...
9
by: Morgan Cheng | last post by:
Hi, I once worked for java in embedded system. Since the memory is limited in embedded system, there are some guidelines for programming. One of them is "Don't create too many classes, because...
0
by: JosAH | last post by:
Greetings, Introduction At this moment we have a TextProcessor, a LibraryBuilder as well as the Library itself. As you read last week a Library is capable of producing pieces of text in a...
3
by: James Abley | last post by:
Hi, I'm trying to understand how CPython implements unicodedata, with a view to providing an implementation for Jython. This is a background, low priority thing for me, since I last posted to...
27
by: Generic Usenet Account | last post by:
Apologies if someone finds this OT I am looking for an open-source C++ implementation of Java API ---- something that does not require a Java run-time environment. So far the only thing that I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.