저는 스프링 저장소 인터페이스를 많이 사용하고 있습니다. 하나는 나를 위해 잘 작동했지만 그때 나는 그것이 조금 더 필요하다는 것을 깨달았다. 나는 GET() 나는 복사 및 붙여 넣기 만 잘하면 다음은이 이해할 수 있도록 충분한 정보를 제공 할 수 있도록 인트라넷에서 작동스프링 저장소 프로젝션 한 객체의 자식 가져 오기
하나 개 더 수준 ...
@Entity
@Table(name="person")
class Person {
...
}
@Entity
@Table(name="requisite")
class Requisite {
...
@OneToOne
@JoinColumn
private Document document;
}
@Entity
@Table(name="person_requisite")
class PersonRequisite {
...
@ManyToOne
@JoinColumn(name="person_id")
private Person person;
...
@ManyToOne
@JoinColumn(name="requisite_id")
private Requisite requisite;
...
}
@Projection(name="personRequisiteProjection", types={PersonRequisite.class})
public interface PersonRequisiteProjection {
...
Person getPerson();
Requisite getRequisite();
...
}
여기를 가고 싶어 내가 지금 무엇입니까 무엇을 표현 ... 여기
"personRequisites" : [ {
...
"requisite" : {
id : 1,
...
no document object or document id from the requisite
},
"person" : {
id : 33,
...
},
...
]
...
내가 원하는 것을의 표현은 ...입니다
"personRequisites" : [ {
...
"requisite" : {
id : 1,
...
"document" : {
"id" : 55,
"name" : blah,
...
}
},
"person" : {
id : 33,
...
},
...
]
...
나는이 정확하지 알고 있지만 난 기본적으로
@Projection(name="personRequisiteProjection", types={PersonRequisite.class})
public interface PersonRequisiteProjection {
...
//i know, this would be out of place if it worked but trying to emphasize what i want...
Document getRequisite().getDocument();
//i'd still want Requisite getRequisite() as well but you get what i am after
...
//or more appropriately, force document to show up in Requisite here...
Requisite getRequisite();
...
}
확인하려면이하시기 바랍니다 https://stackoverflow.com/questions/44554979/how-to-loop-and-retrieve-value-from- hateoas-link-attribute-eg-retrieve-a-des/44564464 # 44564464 –
무슨 농담. 봄 투사를 찾는 어린이는 위의 링크로 연결됩니다. 사람들에게 심각한 무언가가 있습니다. 그들은 싫어합니다. 신이 너를 돌볼거야. – user2052618