M
mike
I have two entities like this
public class FirstEntity{
private SecondEntity second;
.....
}
public class SecondEntity{
private String name;
},
and on web I have a bean that looks like ;
public class Bean{
private FirstEntity first;
}
and I do a select like "select first from FirstEntity first left join
fetch first.second", and i set the result to a bean on the web. Jspx
part has inputText ="#{bean.first.second.name}". My problem is what when
FK to second entity is null(what can be the case), than jspx breaks. Is
there any way to check if query doesn't find SecondEntity(FK) , that
than it creates new SecondEntity
so jspx can render.Thanks in advance.
public class FirstEntity{
private SecondEntity second;
.....
}
public class SecondEntity{
private String name;
},
and on web I have a bean that looks like ;
public class Bean{
private FirstEntity first;
}
and I do a select like "select first from FirstEntity first left join
fetch first.second", and i set the result to a bean on the web. Jspx
part has inputText ="#{bean.first.second.name}". My problem is what when
FK to second entity is null(what can be the case), than jspx breaks. Is
there any way to check if query doesn't find SecondEntity(FK) , that
than it creates new SecondEntity
so jspx can render.Thanks in advance.