Hibernate cross inquiry

xiaoxiao2021-03-06  91

1

2 session s = hibernateutil.

CurrentSession

(

);

3 Transaction t = s.

BeGintransaction

(

);

4

5 query q = s.

CREATEQUERY

("From Trade T, ACLROLE R WHERE T.

TRADE_ID =

1 and r.

ROLENAME =

'Lyorole' "

);

6 Q.

SetFirstResult

(

0

);

7 Q.

SetMaxResults

(

10

);

8

List list = q.

List

(

);

9

10

INT i =

0;

11

for

(i =

0; i

Size

(

); i

)

{

...}

12

Object

[

] o =

(

Object

[

]

List.

get

(i

);

13

for

(

INT j =

0; j

Length; J

)

{

...}

14

Object = o

[J

];

15

IF

(Oo InstanceOf TRADE)

)

{

...}

16 trade tt =

(Trade)

) oo;

17 OUT.

PRINTLN

(" GET Trade:" TT.

Gettrade_id

(

) " "

);

18

}

Else

IF

(Oo InstanceOf Aclrole

)

{

19 ACLROLE R =

(ACLROLE

) oo;

20 OUT.

PRINTLN

(" GET ROLE:" R.

GetroleID

(

) " "

);

twenty one

}

twenty two

twenty three

}

twenty four

}

25 OUT.

PRINTLN

("I is:" i

);

26

27 t.

Commit

(

);

28 hibernateutil.

CloseSession

(

);

转载请注明原文地址:https://www.9cbs.com/read-104090.html

New Post(0)