You should create a view as the query you described and define an entity mapping to this view If you still need the "Code" entity mapped at "Incident", check following example: Entity @Table(name="incident") public class Incident { @Id @Column(name="id") private Integer id; @OneToOne @JoinColumn(name="code1") private CodeA typeACode; @OneToOne @JoinColumn(name="code2") private CodeB typeBCode; public Incident() {} public CodeA getTypeACode() { return this. TypeACode; } public CodeB getTypeBCode() { return this. TypeBCode; } } The "CodeA" is an entity mapping to a view, which comply with CODE_TYPE='A The "CodeB" is same as above recipe.
You should create a view as the query you described and define an entity mapping to this view. If you still need the "Code" entity mapped at "Incident", check following example: @Entity @Table(name="incident") public class Incident { @Id @Column(name="id") private Integer id; @OneToOne @JoinColumn(name="code1") private CodeA typeACode; @OneToOne @JoinColumn(name="code2") private CodeB typeBCode; public Incident() {} public CodeA getTypeACode() { return this. TypeACode; } public CodeB getTypeBCode() { return this.
TypeBCode; } } The "CodeA" is an entity mapping to a view, which comply with CODE_TYPE='A'. The "CodeB" is same as above recipe.
I've been working on the issue some more and I agree. It's come down to putting everything in a view and tying one entity to that. I really wanted a more bernatey way of doing this with the 2 objects as opposed to everything being 1 object, but the only way I can come up with would involve a different Code object for every subquery.
I shortened the query for this example. There's 23 subqueries each with their own code type in the original query. I have 1 user that has hundreds of incidents which causes the program to crash.
Thus the 1 view for now unless I can find another solution. – kelleystar Jul 14 at 22:05.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.