java - Retriving records from database using hibernate -
java - Retriving records from database using hibernate -
i have class trade , subclass operation. mapped in database. when do:
trades = session.createquery("from trade").list() i arraylist of trade records , can access operations trade through trade instance.
however, when do:
trades = session.createquery(" trade trade inner bring together trade.operations operation to_char(operation.datetime, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd') order operation.datetime" ).list(); i array of objects each element contains operation , trade instance.
how retrieve records array of trades (same first option) conditions (same sec option)?
i tried: select trade trade trade inner bring together trade.operations operation to_char(operation.datetime, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd') order operation.datetime
it worked, javatestcase. however, when loop trade.operations, trades contain operations today, operations trade, if it's operation day. doesn't satisfy condition.
any clue?
thanks in advance!!
trade.operations contain operations trade. hibernate won't give trades partial initialized kid collection because breaks alter tracking , leads many confusions downwards road. best hibernate can give pairs of trades , matching operations. create class containing properties need trade , matching operation , utilize aliastobeantransformer.
java hibernate
Comments
Post a Comment