Hi,
I am relativ new to Hibernate and though have a question.
Is it allowed / a good style to have a transient method in one entity that is calculating something and therefore is using an instance of a mapped object?
For example:
Code:
public class A
{
private Long id;
private String s;
private Integer i;
private B b;
[...] getter and setter
@ManyToOne(optional = false, fetch = FetchType.EAGER)
public B getB()
{
return b;
}
@Transient
public Integer calculate()
{
return i - b.getI2(); // IS THIS ALLOWED?
}
}
Code:
public class B
{
private Long id;
private Integer i2;
[...] getter and setter
}
Thanks in advance,
Ole