Component Mapping With Annotation


When we want to store one class object as value to another class object then we have to use component mapping

For Component mapping we have two annotations.
1. Embedable
2.Embeded

A class whose object we want to store like a value of another class object should be annotated with ======> @Embedable

To the reference variable of embedable class we need to as ===> @Embeded annotation
 ===============================================

@Embeddable
public class Address {
    int hno;
    String city;
}

================================================

@Entity
@Table
public class Student {
    @Id
    int id;
    @Column
    String  name;
    @Embedded
Address address;

===============================================

Comments

Post a Comment

Popular posts from this blog

Filter In Javafx

Kotlin with StandAlone Complier