|-- parent
`-- pom.xml
|-- model1
| `-- pom.xml
|-- model2
-- pom.xml
|-- services
-- pom.xml
|-- web-app
-- pom.xml
모델 1과 모델 2는 I이 방법으로 변성 두 받는다는 - 원형 - 빠른있다
|-- model1
|--src
|--main
|--java
|--main
|--resources
|-- META-INF
-- persistence.xml
|-- model2
|--src
|--main
|--java
|--main
|--resources
|-- META-INF
-- persistence.xml
는 더욱이 MODEL2 치어의 I이 종속성
<dependency>
<groupId>it.mycompany</groupId>
<artifactId>model1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
지속성을 갖고 파일은 이제
persistence>
<persistence-unit name="model2Unit">
<class>it.mycompany.Agreement</class>
<class>it.mycompany.AgreementDetail</class>
// and more others
</persistence-unit>
내 문제가 persistence.xml을
<persistence>
<persistence-unit name="model1Unit">
<class>it.mycompany.User</class>
<class>it.mycompany.UserDetail</class>
<class>it.mycompany.Address</class>
<class>it.mycompany.Agent</class>
<class>it.mycompany.Agency</class>
// and more others
</persistence-unit>
모델 2의 persistence.xml
MODEL1 다음과 같은 방법으로 정의되는 매핑 내 model2 프로젝트 다음 작업을 수행하고 싶습니다.
@Entity
public class Agreement{
@Id
@GeneratedValue
private long id;
private String description;
@ManyToOne
private Agent agent;
}
하지만 에이전트 엔티티는 model1 프로젝트/데이터 소스에 포함되어 있습니다. 사실 model2 프로젝트에서 model1 프로젝트의 일부 엔티티를 사용하여 을 다시 작성하지 않으려합니다.
이것이 가능합니까? 제안 사항이 있으십니까?
항목 (테이블)을 이용하여 해결할 다른 두 개의 DB에 속하는? – Suvasis
예 테이블이 서로 다른 두 개의 DB에 속해 있습니다. – Skizzo
계약 및 에이전트가 서로 다른 두 개의 DB에 속해 있다면 논리적/물리적으로 서로 매핑됩니다. DB에서 그들 사이의 관계는 어떻게 존재합니까? 기본적으로 @ManyToOne을 사용하면서 어떤 관계가 종료되는지 알고 싶습니다. – Suvasis