- Q Why using swing for high performance is not a good idea ?
- Q How adaptive do you consider yourself to the environment?
- Q What is the difference between horizontal and vertical partitioning?
- Q What is Landolfi’s sign?
- Q Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }?
- Q What was the name of Felix the Cats girlfriend
- Q Violation of something holy or sacred
- Q Explain how the lubricating oil circulates in a diesel engine.
- Q From everything you've observed, what problems can you cite regarding working in this career?
- Q What is a skeleton in rmi?
- Q What is female sex ratio per 1000 males of Karnataka state in 2011?
Question
How do you implement one to many relationships in Hibernate
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Answers
- For one to many relationships we can consider the example Author and Books (i.e. one Author can have written many books).
- Below code will help you to understand how you can implement one to many relationship in hibernate.
File: Author.javapackage com.test.one.to.many;java.util.Set;public class Author implements java.io.Serializable{ private Integer authorId; private String authorName; private Set books; // getter and setter}
File: Book.javapackage com.test.one.to.many;public class Book implements java.io.Serializable{ private Author author; private Integer bookId; private String bookName; // getter and setter}File: Author.hbm.xml File: Book.hbm.xml File: hibernate.cfg.xml com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/mytestdb root password org.hibernate.dialect.MySQLDialect true true
Your Comment
- Below code will help you to understand how you can implement one to many relationship in hibernate.
File: Author.javapackage com.test.one.to.many;java.util.Set;public class Author implements java.io.Serializable{ private Integer authorId; private String authorName; private Set books; // getter and setter}
File: Book.javapackage com.test.one.to.many;public class Book implements java.io.Serializable{ private Author author; private Integer bookId; private String bookName; // getter and setter}File: Author.hbm.xml
- 0
- 0
- New Answer
- Contributors: *,
More Software Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is marker interface?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What types of partitioning are there for BW?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,