// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/AddressDTO.java
// public class AddressDTO {
// 
// 	public long personId;
// 	public String emailAddress;
// 	public String city;
// 	public String country;
// }


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.osgi.enroute.examples.microservice.dao.dto.AddressDTO;
package org.osgi.enroute.examples.microservice.dao.impl.jpa.entities;



@Entity
@Table(name="addresses")
public class AddressEntity {

    @ManyToOne
    @JoinColumn(name="person_id", foreignKey=@ForeignKey(name="person"))
    private PersonEntity person;
    
    @Id
    @Column(name="email_address")
    private String emailAddress;
    private String city;
    private String country;
    
// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/AddressDTO.java
// public class AddressDTO {
// 
// 	public long personId;
// 	public String emailAddress;
// 	public String city;
// 	public String country;
// }


// Path: examples/microservice/dao-impl-jpa/src/main/java/org/osgi/enroute/examples/microservice/dao/impl/jpa/entities/AddressEntity.java
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.osgi.enroute.examples.microservice.dao.dto.AddressDTO;

package org.osgi.enroute.examples.microservice.dao.impl.jpa.entities;



@Entity
@Table(name="addresses")
public class AddressEntity {

    @ManyToOne
    @JoinColumn(name="person_id", foreignKey=@ForeignKey(name="person"))
    private PersonEntity person;
    
    @Id
    @Column(name="email_address")
    private String emailAddress;
    private String city;
    private String country;
    
    public static AddressEntity fromDTO(PersonEntity person, AddressDTO dto) {