-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: automaticaly returned values by query
PostPosted: Thu Jan 24, 2008 10:59 am 
Newbie

Joined: Thu Jun 14, 2007 5:38 am
Posts: 6
Hi!

I am little bit confused because I can't answer to my easy question...
I have a simple query:

Criteria criteria=sessionFactory.getCurrentSession().createCriteria(SemopsTransaction.class, "T")
.createAlias("events", "E", CriteriaSpecification.INNER_JOIN)
.add(Restrictions.eq("paymentStatus",status))
.add(Restrictions.eq("E.type",type));

List<SemopsTransaction> list = criteria.list();

No any problem with this but when I look at the log I see the following:

15:44:43,218 INFO [STDOUT] Hibernate: select this_.ID_TRANSACTION as ID1_6819_1_, this_.VERSION as VERSION6819_1_, this_.FK_CACCOUNTID_TRANSACTION as FK3_6819_1_, this_.FK_BANKID_TRANSACTION as FK4_6819_1_, this_.PAYMENTSTATUS as PAYMENTS5_6819_1_, this_.TOTAL as TOTAL6819_1_, this_.CURRENCY as CURRENCY6819_1_, this_.TIMESTAMPDB as TIMESTAM8_6819_1_, e1_.ID_TRANSACTIONEVENT as ID1_6820_0_, e1_.VERSION as VERSION6820_0_, e1_.FK_MONEYLID_TRANSACTIONEVENT as FK3_6820_0_, e1_.FK_INDLID_TRANSACTIONEVENT as FK4_6820_0_, e1_.FK_TRANSID_TRANSACTIONEVENT as FK5_6820_0_, e1_.FK_ACCESSID_TRANSACTIONEVENT as FK6_6820_0_, e1_.AMOUNT as AMOUNT6820_0_, e1_.CURRENCY as CURRENCY6820_0_, e1_.TYPE as TYPE6820_0_, e1_.VALUEDATE as VALUEDATE6820_0_, e1_.CUSTOMERSESSIONID as CUSTOME11_6820_0_, e1_.PAYMENTSTATUS as PAYMENT12_6820_0_, e1_.PHASE as PHASE6820_0_, e1_.RECONCILIATIONSTATUS as RECONCI14_6820_0_, e1_.TECHNICALMSGID as TECHNIC15_6820_0_, e1_.BANKROLE as BANKROLE6820_0_, e1_.ISDIRECTTRANSFER as ISDIREC17_6820_0_, e1_.BENEFICIARYNAME as BENEFIC18_6820_0_, e1_.BENEFICIARYADDRESS as BENEFIC19_6820_0_, e1_.BENEFICIARYACCNODOMESTIC as BENEFIC20_6820_0_, e1_.BENEFICIARYACCNOINTERNATIONAL as BENEFIC21_6820_0_, e1_.INTERNATIONALACCNOFMT as INTERNA22_6820_0_, e1_.BENEFICIARYREMARKTYPE as BENEFIC23_6820_0_, e1_.BENEFICIARYREMARK as BENEFIC24_6820_0_, e1_.REASONCODE as REASONCODE6820_0_, e1_.CUSTOMERREMARK as CUSTOME26_6820_0_, e1_.TIMESTAMPDB as TIMESTA27_6820_0_ from SEMOPSTRANSACTION this_ inner join TRANSACTIONEVENT e1_ on this_.ID_TRANSACTION=e1_.FK_TRANSID_TRANSACTIONEVENT where this_.PAYMENTSTATUS=? and e1_.TYPE=?

15:44:43,234 INFO [STDOUT] Hibernate: select paymentlog0_.ID_TRANSFERLOG as ID1_6822_0_, paymentlog0_.VERSION as VERSION6822_0_, paymentlog0_.AMOUNT as AMOUNT6822_0_, paymentlog0_.CURRENCY as CURRENCY6822_0_, paymentlog0_.LEGACYID as LEGACYID6822_0_, paymentlog0_.TIMESTAMPLOG as TIMESTAM7_6822_0_, paymentlog0_.STATUS as STATUS6822_0_, paymentlog0_.FK_EVENTID_TRANSFERLOG as FK9_6822_0_, paymentlog0_.FK_CSACCOUNT_TRANSFERLOG as FK10_6822_0_, paymentlog0_.FK_TRACCOUNT_TRANSFERLOG as FK11_6822_0_, paymentlog0_.FK_SACCOUNT_TRANSFERLOG as FK12_6822_0_, paymentlog0_.FK_CRACCOUNT_TRANSFERLOG as FK13_6822_0_, paymentlog0_.DISCRIMINATOR as DISCRIMI2_6822_0_ from TRANSFERLOG paymentlog0_ where paymentlog0_.FK_EVENTID_TRANSFERLOG=? and paymentlog0_.DISCRIMINATOR in ('OPL', 'ONPL')
15:44:43,250 INFO [STDOUT] Hibernate: select merchanttr0_.ID_TRANSFERLOG as ID1_6822_0_, merchanttr0_.VERSION as VERSION6822_0_, merchanttr0_.AMOUNT as AMOUNT6822_0_, merchanttr0_.CURRENCY as CURRENCY6822_0_, merchanttr0_.LEGACYID as LEGACYID6822_0_, merchanttr0_.TIMESTAMPLOG as TIMESTAM7_6822_0_, merchanttr0_.STATUS as STATUS6822_0_, merchanttr0_.FK_EVENTID_TRANSFERLOG as FK9_6822_0_, merchanttr0_.FK_TSACCOUNT_TRANSFERLOG as FK15_6822_0_, merchanttr0_.FK_CRACCOUNT_TRANSFERLOG as FK13_6822_0_, merchanttr0_.DISCRIMINATOR as DISCRIMI2_6822_0_ from TRANSFERLOG merchanttr0_ where merchanttr0_.FK_EVENTID_TRANSFERLOG=? and merchanttr0_.DISCRIMINATOR in ('MCL', 'MDL')

15:44:43,250 INFO [STDOUT] Hibernate: select reservatio0_.ID_TRANSFERLOG as ID1_6822_0_, reservatio0_.VERSION as VERSION6822_0_, reservatio0_.AMOUNT as AMOUNT6822_0_, reservatio0_.CURRENCY as CURRENCY6822_0_, reservatio0_.LEGACYID as LEGACYID6822_0_, reservatio0_.TIMESTAMPLOG as TIMESTAM7_6822_0_, reservatio0_.STATUS as STATUS6822_0_, reservatio0_.FK_EVENTID_TRANSFERLOG as FK9_6822_0_, reservatio0_.FK_CSACCOUNT_TRANSFERLOG as FK10_6822_0_, reservatio0_.FK_TRACCOUNT_TRANSFERLOG as FK11_6822_0_, reservatio0_.FK_RACCOUNT_TRANSFERLOG as FK14_6822_0_, reservatio0_.DISCRIMINATOR as DISCRIMI2_6822_0_ from TRANSFERLOG reservatio0_ where reservatio0_.FK_EVENTID_TRANSFERLOG=? and reservatio0_.DISCRIMINATOR in ('ORL', 'ONRL')

15:44:43,250 INFO [STDOUT] Hibernate: select customerac0_.ID_CUSTOMERACCOUNT as ID1_6799_0_, customerac0_1_.VERSION as VERSION6799_0_, customerac0_1_.ACCOUNTNO as ACCOUNTNO6799_0_, customerac0_1_.ACTIVE as ACTIVE6799_0_, customerac0_1_.INTERNATIONALACCNOFORMAT as INTERNAT5_6799_0_, customerac0_1_.INTERNATIONALACCNO as INTERNAT6_6799_0_, customerac0_1_.CURRENCY as CURRENCY6799_0_, customerac0_.FK_CLIENTID_CACCOUNT as FK2_6801_0_, customerac0_.FK_LIMITPACKAGEID_CACCOUNT as FK3_6801_0_, customerac0_.SEMOPSID as SEMOPSID6801_0_, customerac0_.MERCHANTLONGNAME as MERCHANT5_6801_0_, customerac0_.SUPERVISORID as SUPERVIS6_6801_0_, customerac0_.SUPERVISORPWD as SUPERVIS7_6801_0_ from CUSTOMERACCOUNT customerac0_ inner join ACCOUNT customerac0_1_ on customerac0_.ID_CUSTOMERACCOUNT=customerac0_1_.ID_ACCOUNT where customerac0_.ID_CUSTOMERACCOUNT=?

15:44:43,265 INFO [STDOUT] Hibernate: select client0_.ID_CLIENT as ID1_6805_0_, client0_.VERSION as VERSION6805_0_, client0_.USERNAME as USERNAME6805_0_, client0_.FIRSTNAME as FIRSTNAME6805_0_, client0_.LASTNAME as LASTNAME6805_0_, client0_.CITY as CITY6805_0_, client0_.ZIP as ZIP6805_0_, client0_.ADDRESS as ADDRESS6805_0_, client0_.COUNTRY as COUNTRY6805_0_, client0_.PHONE1 as PHONE10_6805_0_, client0_.PHONE2 as PHONE11_6805_0_, client0_.EMAIL as EMAIL6805_0_, client0_.LEGACYID as LEGACYID6805_0_, client0_.STATUS as STATUS6805_0_, client0_.STATE as STATE6805_0_ from CLIENT client0_ where client0_.ID_CLIENT=?


I can't understand this huge amount of query and join... I want to ask only for event and transaction and I am not intrested in other tables...
I don't have lazy=false in my hbm.xml and I couldn't find any properties with this I can avoid these additional queries and joins....

This is one part of my event hbm.xml:

<one-to-one name="payment" class="com.fornax.semops.bank.db.entities.PaymentLog" property-ref="transEvent" constrained="true" cascade="save-update" />
<one-to-one name="beneficiaryTransfer" class="com.fornax.semops.bank.db.entities.MerchantTransferLog" property-ref="transEvent" constrained="true" cascade="save-update" />
<one-to-one name="reservation" class="com.fornax.semops.bank.db.entities.ReservationLog" property-ref="transEvent" constrained="true" cascade="save-update" />
<one-to-one name="directSettlement" class="com.fornax.semops.bank.db.entities.DirectSettlementLog" property-ref="transEvent" cascade="save-update" constrained="true"/>

<many-to-one name="moneyTransferNotice" class="com.fornax.semops.bank.db.entities.MoneyTransferNoticeLog" >
<column name="FK_MONEYLID_TRANSACTIONEVENT" precision="22" scale="0" />
</many-to-one>
<many-to-one name="indirectSettlement" class="com.fornax.semops.bank.db.entities.IndirectSettlementLog" >
<column name="FK_INDLID_TRANSACTIONEVENT" precision="22" scale="0" />
</many-to-one>
<many-to-one name="transaction" class="com.fornax.semops.bank.db.entities.SemopsTransaction" fetch="select" >
<column name="FK_TRANSID_TRANSACTIONEVENT" precision="22" scale="0" not-null="true" unique-key="unique_transevent"/>
</many-to-one>


How this terrible join and lot of additional query are built?

Thanks,
topicfun


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.