[Hibernate-JIRA] Commented: (HHH-1657) hql update generate wrong sql with joined subclass hierarcy
by Frank D. Martinez (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
Frank D. Martinez commented on HHH-1657:
----------------------------------------
Hi Peter,
I have tried the patch attached to HHH3150 but the problem is still there.
I don't know why but with joined subclass, some queries have the form:
select .....
where .....
order by id
the problem is in the unqualified id reference in the order clause.
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Assignee: Gail Badner
> Priority: Critical
> Fix For: 3.2.x, 3.3.0
>
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[Hibernate-JIRA] Created: (HHH-3250) session.clear() throws NullPointerException intermittently
by Arturo Campos (JIRA)
session.clear() throws NullPointerException intermittently
----------------------------------------------------------
Key: HHH-3250
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3250
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6ga, Oracle 10g, JRE 1.5
Reporter: Arturo Campos
Receiving the following NullPointerException sometimes when calling session.clear() .
java.lang.NullPointerException
at org.hibernate.engine.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:188)
at org.hibernate.impl.SessionImpl.clear(SessionImpl.java:255)
...
Our GUI application tries to reuse a session as shown in the simplified method below.
This method may be called repeteadly from a clear/refresh button in a GUI screen. Data changes (DAO fields updated) to the session
may or may not be made at discretion of the user.
It is difficult to pinpoint the frequency as to when this happens. Sometimes the method may be called 10 times without incident. Try it
at some other time and it may throw the exception after just couple of times.
After the exception occurs the session becomes unusable and throws other exceptions if the user tries
other operations such as save (update DB).
// Note: session instanciated elsewhere (cacheMode = NORMAL)
public void sessionReset()
{
m_session.getTransaction().rollback();
m_session.clear();
m_session.beginTransaction();
load(); // query to load/reload records
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1261) "WHERE" class mapping element not used during association navigation
by Gareth Chapman (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1261?page=c... ]
Gareth Chapman commented on HHH-1261:
-------------------------------------
Hi,
I've been searching the web and this bug list all afternoon, but can't find any reference to discussions on this topic. Would you please supply me with a link to the discussions you mention, I would like to know the arguments against implementing this.
Thanks.
> "WHERE" class mapping element not used during association navigation
> --------------------------------------------------------------------
>
> Key: HHH-1261
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1261
> Project: Hibernate3
> Issue Type: Improvement
> Components: core
> Environment: All versions and platforms
> Reporter: Alexei
>
> For example a Employee->User association
> Class Employee:
> <class name="Employee, MyApp" table="Employee" where="inactive=0" >
> ...
> <many-to-one name="User" class="User, MyApp"
> column="UserId" unique="true" not-null="false" >
> Class User:
> <class name="User, MyApp" table="Users" where="inactive=0" >
> Will generate SQL:
> SELECT... FROM Employee this LEFT OUTER JOIN Users user1_ ON this.UserId=user1_.id WHERE this.inactive=0
> As you see the "user1_.deleted=0" would not be genetated and User objects will be retrived ignoring the "inactive" flag on Users table. Similar behaviour with <bag>, <one-to-one> and others.
> This feature is important for us since we work mostly with legacy data and do not have the luxury of designing our own databases.
> I am NHibernate user and I have NHibernate request submited - http://jira.nhibernate.org/browse/NH-467 ; however Sergey Koshcheyev would not implement this in NHibernate unless Hibernate implements it 1st, which is quite understandable.
> Also, per Gavin :
> "The where clause is not used at all during association navigation. I suspect you might be able to argue that it should be used for navigating many-to-many associations. If you think so, sibmit a feature request to JIRA and I'll give it some thought" (see http://forum.hibernate.org/viewtopic.php?t=189 ).
> Actually, I think I am ready to argue that top-level class definition clauses should be used in any type of object instantiation. Would it be possible to consider this implementation?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[Hibernate-JIRA] Created: (ANN-729) Mapping problem
by bharat shah (JIRA)
Mapping problem
---------------
Key: ANN-729
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-729
Project: Hibernate Annotations
Issue Type: Task
Environment: Windows xp,ibm db2
Reporter: bharat shah
Attachments: bug.zip
Hi
I have three tables, offer,offertax,tax_dm and quote. The hbm for all the three tables are attached. offertax has a foreign key relationship with offer and tax_dm. tax_dm has a one to many relationship with quote. i am doing the following things when i create a new tax_dm object
Tax tax = new Tax();
quote.getTaxes().add(tax);
tax.setTaxDescription(adminTax.getTaxName());
tax.setTaxName(adminTax.getTaxName());
tax.setQuote(quote);
tax.registerNewOrDirty();
OfferTax offerTax = new OfferTax();
//set it in tax domain
offertaxes.add(offerTax);
offerTax.setTaxPercentage(new Double(Formatter.ConvertStringToDouble(adminTax.getTaxValue())));
offerTax.setTaxAmount(new Double(0.00));
offerTax.setTax(tax);
offerTax.registerNewOrDirty();
offerTax.setOffer(offer);
registerNewOrDirty() registers the object with the hibernate session
but when i do this it gives me an error "SQL excpetion " trying to insert null into offer tax. this is because the insert query in offer tax fires before the insert query in tax_dm. Hence it is not able to find the foregin key association with tax_dm. Here is the log
O Hibernate: insert into U90JDQD.QUOTE (QUOTE_NM, ACCT_FLEX_ID, STAT_ID, QUOTE_TYP_ID, SLPRSN_ID, CRTD_BY, CUST_NOTES, INTRN_NOTES, MOD_BY, CRTN_DT, EXPR_DT, MOD_DT, DLR_CO_MSTR_IND, PUBLISHED_DT, MARG, CERES_APPL_ID, QUOTE_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:29:931 IST] 6bc06bc0 SystemOut O Hibernate: select identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:30:181 IST] 6bc06bc0 SystemOut O Hibernate: insert into U90JDQD.QUOTE_CUST (FRST_NM, LAST_NM, BUSN_NM, PHN_NUM, CNTRY, ADDR_LINE_1, ADDR_LINE_2, CITY, ST_PRVNC_CD, PSTL_CD, CNTY, EMAIL_ADDR, QUOTE_ID, CUST_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:30:431 IST] 6bc06bc0 SystemOut O Hibernate: select identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:30:666 IST] 6bc06bc0 SystemOut O Hibernate: insert into U90JDQD.OFFR (OFFR_NM, OFFR_DSC, PRPSL_INCL_IND, SEL_IND, QUOTE_ID, OFFR_ID) values (?, ?, ?, ?, ?, default)
[4/22/08 17:47:30:900 IST] 6bc06bc0 SystemOut O Hibernate: select identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:31:134 IST] 6bc06bc0 SystemOut O Hibernate: insert into U90JDQD.FNCE_OFFR (FNCL_OFFR_NM, PRPSL_INCL_IND, SEL_IND, RNTL_APPLD_AMT, DWN_PYMT_AMT, RT_PCT, OFFR_ID, FNCL_OFFR_ID) values (?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:31:369 IST] 6bc06bc0 SystemOut O Hibernate: select identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:31:619 IST] 6bc06bc0 SystemOut O Hibernate: insert into U90JDQD.OFFR_TAX (TAX_AMT, TAX_PCT, OFFR_ID, TAX_ID, OFFR_TAX_ID) values (?, ?, ?, ?, default)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R com.deere.u90.iaf.spring.exception.SpringPersistenceException:
Failure processing IAFHibernateTemplate.persist(Object).
timestamp: 2008-04-22 05:47:32.322 PM IST (1208866652322)
SQL Exception Message: Assignment of a NULL value to a NOT NULL column "TBSPACEID=5, TABLEID=8, COLNO=2" is not allowed.
SQL State: 23502
SQL Code: -407
entity: id = 2611039 statusCode = null sbuCode = null creationTime = null internalNote = modifiedTime = Tue Apr 22 17:47:29 IST 2008 totalAmount = 0.0 Quotename = null createdBy = SL35418 creationDate = Tue Apr 22 17:47:14 IST 2008 modifiedBy = SL35418 markQuotesExpired = false quoteStatus = code = ACdescription = Active dealerShip = -83763541 accountNumber = SL3541 email = null address = [Address]: Address1 = ONE JOHN DEERE PLACEAddress2 = , City = 'MOLINE', State = IL, Postal Code = 61265, Country = com.deere.jdquote.domain.Country@63016301, County = , email = null customer = ckcID = 0lastName = firstName = middleName = businessName = phone = cellPhone = fax = nullemail = editURL = nullisEmp = trueerror = falseCkcIDMerged = falseerrorMessage = nullracfID = nullcustomerDealerAccount = 0commLocID = 0commTypeID = 0continueButtonClicked = falsemiddleInitial = generation = phyUsCountyCode = nullmailAddressPresent = falsephyAddressPresent = falsephyCaCCSDCode = nullphyCaCDCode = nullphyCountyName = nullphyCountry = nullphyState = nullphyStreetAddress = nullmailCountry = nullmailState = nullmailUsCountyCode = nullmailCaCCSDCode = nullmailCaCDCode = nullmailCountyName = nullcountyName = nullpurchaserAcct = nullsalesTaxExempt = nullprofilingDealerID = nullIndividual = falseBusiness = falsemerged = falseJDAIM_CUSTOMER_SOURCE = jdaimaddress = [Address]: Address1 = [Add1 is null]Address2 = [Add2 is null], City = [city is null], State = [state is null], Postal Code = [postal code is null], Country = com.deere.jdquote.domain.Country@3770377, County = null, email = nullcustomerType code = 0type = null salesperson = racfID = SL35418name = LAHOTI,SHOURABHdealerId = nullcompositeID = nullphoneNumber = nullemail = LahotiSourabh(a)JohnDeere.com TradeInEquipments Set Size = 0 Equipments Set Size = 0 Set Of Quote Proposal Option Size = 12 Set Of Proposal Product Info Size = 0 quoteType quoteTypeId = 2quoteTypeName = PurchasequoteTypeDesc = 2
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.spring.orm.hibernate.IAFHibernateTemplate.persist(IAFHibernateTemplate.java:701)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.ejpm.persistence.datamappers.EJPMHibernateMapper.add(EJPMHibernateMapper.java:32)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.jdquote.persistence.datamappers.QuoteMapper.add(QuoteMapper.java:516)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.ejpm.persistence.UnitOfWork.insertNew(UnitOfWork.java:397)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.ejpm.persistence.UnitOfWork.access$0(UnitOfWork.java:390)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.ejpm.persistence.UnitOfWork$1.doInTransactionWithoutResult(UnitOfWork.java:193)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at com.deere.u90.iaf.spring.transaction.IAFTransactionCallbackWithoutResult.doInTransaction(IAFTransactionCallbackWithoutResult.java:22)
[4/22/08 17:47
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[Hibernate-JIRA] Created: (HHH-3202) Problem with different aliases in select and where clauses
by Neil Hart (JIRA)
Problem with different aliases in select and where clauses
----------------------------------------------------------
Key: HHH-3202
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3202
Project: Hibernate3
Issue Type: Bug
Components: build
Affects Versions: 3.2.6, 3.2.5
Environment: Oracle 10G, Java 1.5.0_11
Reporter: Neil Hart
Our code is usually building the following query:
* criteria query */ select
this_.ID as ID2_0_,
this_.rateDate as rateDate2_0_,
this_.ticker as ticker2_0_,
this_.currency as currency2_0_,
this_.rate as rate2_0_
from
BbgDailyRateData this_
where
this_.rateDate between to_date('2008-03-24 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
and to_date('2008-03-24 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
and this_.currency='USD'
Every night we bounce our 4 servers and once or twice a week a server will end up trying to run the query as:
/* criteria query */ select
dailybbgra0_.ID as ID2_0_,
dailybbgra0_.rateDate as rateDate2_0_,
dailybbgra0_.ticker as ticker2_0_,
dailybbgra0_.currency as currency2_0_,
dailybbgra0_.rate as rate2_0_
from
BbgDailyRateData dailybbgra0_
where
this_.rateDate between to_date('2008-03-23 00:00:00',
'YYYY-MM-DD HH24:MI:SS') and to_date('2008-03-23 23:59:59', 'YYYY-MM-DD
HH24:MI:SS')
and this_.currency='USD'
without any changes to code or configuration. We quickly notice the problem and restart the server and the problem goes away.
The Java we are running is (using Spring):
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Date from = DateUtils.getStartOfDay(date);
Date to = DateUtils.getEndOfDay(date);
Criteria criteria = session.createCriteria(DailyBbgRateData.class);
criteria.add(Expression.between("date", from, to));
criteria.add(Expression.eq("currency", currency));
return criteria.list();
}
});
The mapping is:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.creditex.backoffice.defaultswap.BbgCdswData" table="TRADEBBGCDSW">
<cache usage="nonstrict-read-write" />
<id name="id">
<column name="ID" precision="10" scale="0" />
<generator class="assigned"/>
</id>
<property name="bbgTicker" column="bbgTicker" length="32" not-null="true" />
<property name="settlementDate" column="settlementDate" />
<property name="maturityDate" column="maturityDate" />
<property name="effectiveDate" column="effectiveDate" />
<property name="firstCouponDate" column="firstCouponDate" />
<property name="nextToLastCouponDate" column="nextToLastCouponDate" />
<property name="spread" column="spread" precision="8" scale="3" />
<property name="curveDate" column="curveDate" />
<property name="notional" column="notional" precision="12" scale="0" />
<property name="currency" column="currency" length="3" not-null="true" />
<property name="paymentFrequency" column="paymentFrequency" length="1" not-null="true" />
<property name="recoveryRate" column="recoveryRate" precision="7" scale="6" />
<property name="flatSpread" column="flatSpread" precision="8" scale="3" />
<property name="cnvBpv" column="cnvBpv" precision="10" scale="2" />
<property name="swapCurveBpv" column="swapCurveBpv" precision="10" scale="2" />
<property name="marketValue" column="marketValue" precision="10" scale="2" />
<property name="netAccruedInterest" column="netAccruedInterest" precision="10" scale="2" />
<property name="daysAccrued" column="daysAccrued" precision="4" scale="0" />
<property name="payCurveNumber" column="payCurveNumber" length="4" />
<property name="payCurveMktSide" column="payCurveMktSide" length="20" not-null="true" />
<property name="securityDescription" column="securityDescription" length="32" not-null="true" />
<property name="replSpread" column="replSpread" precision="8" scale="3" />
<property name="buySellFlag" column="buySellFlag" length="1" not-null="true">
<type name="com.creditex.db.hibernate.StringLabeledEnumUserType">
<param name="targetClass">com.creditex.trading.TradeDirection</param>
</type>
</property>
<property name="busDays1" column="busDays1" length="3" />
<property name="busDays2" column="busDays2" length="3" />
<property name="busDays3" column="busDays3" length="3" />
<property name="cashSettledOn" column="cashSettledOn" />
<property name="quotedPrice" column="quotedPrice" precision="12" scale="8" />
<property name="dealRecoveryRate" column="dealRecoveryRate" precision="7" scale="6" />
<property name="priceToSpreadMode" column="priceToSpreadMode" precision="1" scale="0" />
<property name="swapPremium" column="swapPremium" precision="12" scale="2" />
<property name="dateGenMethod" column="dateGenMethod" length="20" not-null="true" />
<property name="payAccrued" column="payAccrued" type="yes_no" length="1" />
</class>
</hibernate-mapping>
This problem has been persistent from Hibernate 3.2.5.ga and 3.2.6.ga. The Java is 1.5.0_11 and the database is Oracle 10G.
This is the first query that we run on startup that has the problem. Once we see this query failing, other queries for different classes fail with the same alias problem. Anyone have any ideas.
I think this might be related to HHH-2847; which was also not repeatable but does repeats.
Thanks
Neil Hart
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months