Write a code to do the component mapping in hibernate.
Answer / Vikas Kumar Rao
Component mapping is used for mapping an immutable, composited Java object as if it were a single table. Here's an example of how to use it:nn@Entitynpublic class Order {n @Idn private Long id;nn @Embeddedn private Address address;nn // constructors, getters and setters...}nn@Embeddablenpublic class Address {n private String street; n private String city; n // constructors, getters and setters...}
| Is This Answer Correct ? | 0 Yes | 0 No |
Is sessionfactory singleton in hibernate?
What is hibernate configuration file?
What is second level cache in hibernate?
What is fetch in hibernate?
What is the difference between hibernate session get() and load() method?
How does hibernate useful in mapping object and its relations?
What is dialect in hibernate?
How do you integrate hibernate with struts2 or servlet web applications?
Why do you use hibernate?
What is cascade in hibernate in which scenario we use it?
What is the difference between unidirectional and bidirectional hibernate?
Is it possible to perform collection mapping with one-to-one and many-to-one?