D
Donkey Hot
Lets have an entitybean, say UserBean
class UserBean extends EntityBean
{
Long id ;
String name ;
Integer height ;
...
// and the getters and setters
}
// and the Local and Remote interfaces... and a POJO with similar
// properties..
How does the EJB (2.x) container generate SQL when updating entitybeans
properties?
I have seen code like this
void updateUser(UserPOJO user)
{
UserLocal userLocal = UserLocalHome.findByPrimaryKey(
new UserKey(user.getId()) ; // or something
if (!user.getName().equals(userLocal.getName())
userLocal.setName(user.getName()) ;
if (!user.getHeight().equals(userLocal.getHeight())
userLocal.setHeight(user.getHeight()) ;
}
Do the ejb setters mark properties as dirty, and generate SQL according to
that, or would the end result be same, if the all properties would be
always updated without checking if there is any difference?
class UserBean extends EntityBean
{
Long id ;
String name ;
Integer height ;
...
// and the getters and setters
}
// and the Local and Remote interfaces... and a POJO with similar
// properties..
How does the EJB (2.x) container generate SQL when updating entitybeans
properties?
I have seen code like this
void updateUser(UserPOJO user)
{
UserLocal userLocal = UserLocalHome.findByPrimaryKey(
new UserKey(user.getId()) ; // or something
if (!user.getName().equals(userLocal.getName())
userLocal.setName(user.getName()) ;
if (!user.getHeight().equals(userLocal.getHeight())
userLocal.setHeight(user.getHeight()) ;
}
Do the ejb setters mark properties as dirty, and generate SQL according to
that, or would the end result be same, if the all properties would be
always updated without checking if there is any difference?