Prior to going to JavaOne, the main subjects I was looking forward to were generics, EJB3 and the AOP panel. The actual experience was different though: sessions on generics did not show me much I had not already read online, and the main thing to take away from the AOP panel was that it can be useful, but don't overdo it - duh.
The EJB persistence session was interesting though: it looks like the EJB 3.0 spec will finally make Entity beans useful again. No more interfaces to implement, POJOs instead of abstract classes (so you can actually test against them outside of the container) and no more home+remote+bean+2deployment-descriptors per EJB.
Most importantly though, EJBQL becomes vastly more useful, allowing you to use it for almost anything you can do with SQL. You can, for instance, use bulk operations like
Also, there will be support for sub-queries, as inDELETE FROM Customer c WHERE c.status = 'inactive' UPDATE Customer c SET c.status = 'outstanding' WHERE c.balance < 10000
and joins will also be supported:SELECT goodCustomer FROM Customer goodCustomer WHERE goodCustomer.balance < (SELECT AVG(c.balance) FROM Customer c) SELECT DISTINCT emp FROM Employee emp WHERE EXISTS(SELECT spouseEmp FROM Employee spouseEmp WHERE spouseEmp = emp.spouse)
TheSELECT i.category FROM Item i JOIN j.bids b WHERE b.amount > :amount SELECT i FROM Item i LEFT JOIN FETCH i.bids WHERE i.category = 'paintings'
FETCHabove means that the bids objects will be prefetched from the database when the items are retrieved, instead of the current situation where there will be one extra query for every bid object.
EJBQL will even support
GROUP BY and
HAVING. My personal favorite though is projection, allowing you to retrieve select fields from select objects, as in
The first query will return an Object-array, the second will return actualSELECT c.id, c.status FROM Customer c JOIN c.orders o WHERE o.count > 100 (returns object array) SELECT new CustomerDetails(c.id, c.status, o.count) FROM Customer c JOIN c.orders o WHERE o.count > :ordercount
As interesting as all this was though, it still wasn't my favorite session, on which I'll blog more later this weekend...