Hi! This is great news :-) And it remembers me of a mail i sent to Sun
as a comment regarding the 2.0 spec. I never got any answer on it and i
thought that i might send it to the jBoss experts instead. Here it
follows, rather long but...

<snip>
"...
But one thing in the spec has made me thinking! It's about the new
Entity Home methods. I read the JavaWorld article by Richard
Monson-Haefel
(http://www.javaworld.com/javaworld/jw-06-2000/jw-0609-ejb_p.html) where
he points out the major things that is coming in EJB 2.0.

He has an example on a Entity Home method that looks like this:
public interface EmployeeHome extends javax.ejb.EJBHome{
  public void applyCola(double increase) throws RemoteException;
  ...
}
public abstract class EmployeeBean implements javax.ejb.EntityBean{
  ...
  public void ejbHomeApplyCola(double increase){
    Collection c = ejbSelectAllEmployees();
    Iterator i = c.iterator();
    while(i.hasNext()){
      Employee e = (Employee)i.next();
      double salary = e.getAnnualSalary();
      salary = salary + (salary * increase);
      e.setAnnualSalary(salary);
    }
  }
  ...
}

Ok, it is very handy with this Entity Home method. But the first thing
that come to my mind was, why can't this method be connected to a SQL
statement in the deployment descriptior? One like this:
UPDATE employee SET annual_salary = annual_salary * ?

Why? Well one reason i can think of would be that the EJB container
misses this update and any cached employee instances in the container
would be incorrect. But wouldn't it be possible to have in the container
contract that when such a method is executed the container should look
through all it's cached instances and in some way mark them as invalid
or just throw them away or maybe automatically reload them.

This one would really really really be a performance hit, because such
kind of methods is used very often in a typical application. It could be
a method like the one above, or a method where a group of records should
have their status changed or whatever."
<snip>

Any comments from the jBoss experts?

/Lennart


Rickard �berg skrev:
> 
> All,
> 
> I have now added support for EJB 2.0 Home methods in jBoss.
> 
> What does this mean?
> 
> Basically, in EntityBeans you can have arbitrary methods in your home
> interface. When you call them the container will pick an anonymous bean
> instance and invoke the method "public <result> ejbHome<name>(<args)"
> where result, name, and args relate to the home method. This allow you
> to put "static" methods for the bean in the home interface.
> 
> Note that the name of the method in the bean will be quite ugly. If your
> home method is called "doStuff" the bean method will be "ejbHomedoStuff"
> which isn't very pretty IMHO. Just FYI.
> 
> regards,
>   Rickard
> 
> ps. funny note: the implementation of this feature required the massive
> amount of about 10 lines in EntityContainer... geeez, that was hard...
> 
> --
> Rickard �berg
> 
> Email: [EMAIL PROTECTED]
> http://www.telkel.com
> http://www.jboss.org
> http://www.dreambean.com
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]

-- 
mailto:[EMAIL PROTECTED]
http://www.benefit.se/english
Or try Yahoo! Messenger, my nickname is: en_grillad_special


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to