大家都在讨论Hibernate,难到他没有缺点???

03-09-05 forever

web+sessionBean+entitybean

web+sessionBean+Hibernate

这两种比较Hibernate这种方式难道就没有缺点了.

比较许多appserver都优化了entitybean?

              

1
forever
2003-09-05 11:19

如weblogic提供了WebLogic-QL Extensions:

• ORDERBY for sorting on the database side when this feature is available, which is

faster than sorting on the client side.

• GROUP BY for grouping results on the database side when this feature is

available, which is faster than grouping on the client side

• Sub-queries, for example SELECT… WHERE x > (SELECT …).

• Multi-column ejbSelect queries, for example SELECT field1, field2 …,

with the result being returned as a java.sql.ResultSet.

• Many numeric aggregate functions:

• MIN(field)

• MAX(field)

• AVG(field) and AVG(DISTINCT field)

• SUM(field) and SUM(DISTINCT field)

• COUNT(field) and COUNT(DISTINCT field)

forever
2003-09-05 11:20

还提供了:

Dynamic Queries

Dynamic queries:

 enable executing arbitrary EJB-QL queries at

run time

 are ideal when the queries are not known at

design time

Client code Snippet:

...

AccountHome acctHome = (AccountHome)ctx.lookup("AccountEJB");

Sring ejbql = "SELECT OBJECT(a) FROM AccountBean a " +

"WHERE a.accountType = ’Savings’";

QueryHome qh = (QueryHome)acctHome;

Query query = qh.createQuery();

Collection results = query.find(ejbql); //returns Account objects

forever
2003-09-05 11:21
WebLogic-QL Examples:

A Few Examples:

SELECT OBJECT(a) FROM AccountBean AS a ORDERBY a.accountId ASC

…gets accounts ordered by account ID.

SELECT OBJECT(a) FROM AccountBean AS a

ORDERBY a.accountType; a.balance DESC

…gets accounts ordered by account type, and then by descending balance

SELECT MAX(a.balance), MIN(a.balance) FROM AccountBean AS a

GROUP BY a.accountType

…gets a list containing the biggest and smallest balance of each account type

SELECT DISTINCT( MIN(a.balance) ) OBJECT(a)

FROM AccountBean AS a GROUP BY a.accountType

…gets a list containing the smallest balance of each account type, with no repetition

SELECT OBJECT(a1) FROM AccountBean AS a1

WHERE a1.accountType = %1 AND a1.accountId IN

(SELECT a2.accountId FROM AccountBean AS a2

WHERE a2.balance > 0)

…gets accounts of a certain type, for which the balance is grater than zero.

forever
2003-09-05 11:23
EntityBean毕竟对事务的处理非常灵活,可以进行声明.

还有提供了相应的cache,pool,read-only等特性.

猜你喜欢
28Go 1 2 3 4 ... 28 下一页