Friday, 15 January 2010

java - How to merge two Hibernate Queries? -


I need to merge results with two different questions to sort results according to date.

i would like to:

  def query = "" Select user (v.user select, v.date was created as v Where v.item =: item sequence created by v.date), as myvotes, (c.user select, c.date is created from the comment as c where c.item =: item order C.date) mycomments def item = // some items tmpUsers = Message.executeQuery (query, [item: items])   

How do I merge two questions ?

V = alt = "item" "def query2 =" "" "" "" "as def Vote "=" "C.item =: item" "DEF result 1 = XAQUTEQ (query1, [item: 'A'])" "" Select the new map (C user as user, CDT.def result2 = Comment. Exquisition (query2, [item: 'A']) DRF merge DList = ([] B.dtCreated & lt; = & gt; A.dtCreated} Render Merge List as Gail Converters.JSON} < / Code>

I agree that there is no appropriate union in HQL, if there is no way associated with vote comment , then the above implementation ( 1 basic question instead of complex one). What will be expected.

Perception, class vote {string item date dtCreated string user} class comment {string item date dtCreated String user} // bootstrap def vote 1 = new vote (item: "a", dtCreated: newest DTH: (at: "A", DT cut: new date (+ 1, user: 'user2') DEF vote 3 = new vote (item: "A", DT rated: new date ( ); 2) New comment (item: "A"), commented on the comment (item: "user 3 ') DEF comment 1 = new comment (item:" A ", dtcated: new date (), user:' user4 ') DtCreated: new date () - 4, user: 'user5') comment 3 = new comment (item: "a", dtCreated: new date () - 6, user: 'user6') [Vote 1, Vote 2, Vote 3, comment1 (tip) Note: "2013-06-23T13: 49: 24Z", "User": "user3"}, {{"dtCreated": "" DtCreated ":" 2013-06-22T13: 49: 24Z "," User ": "User2"}, "user": "user": "user": {"dtCreated": "2013-06-21T13: 49: 24Z", {"dtCreated": "2013-06-21T13: 49: 24Z" , "User1"}, {"dtCreated": "2013-06-17T13: 49: 24Z", "user": "user5"}, {"dtCreated": "2013-06-15T13: 49: 24Z "," User ":" User6 "}]

No comments:

Post a Comment