[Hibernate-JIRA] Created: (HHH-5946) Wrong generated SQL when used composite user type in HQL with not equal operator
by Emanuele Gesuato (JIRA)
Wrong generated SQL when used composite user type in HQL with not equal operator
--------------------------------------------------------------------------------
Key: HHH-5946
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5946
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.1
Environment: hibernate version 3.6.1, databases db2 and oracle
Reporter: Emanuele Gesuato
Attachments: CompositeUserTypeTest.java, patch.txt
If i use a not operator in a hql query using a composite user type (that uses at least two fields) the sql generated has an AND statement between the elements but i expect an OR instead.
I have tried to reproduce a bug using an hibernate test case.
In particular using the following class:
{code:title=org.hibernate.test.cut.Transaction.java|borderStyle=solid}
public class Transaction {
private Long id;
private String description;
private MonetoryAmount value;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public MonetoryAmount getValue() {
return value;
}
public void setValue(MonetoryAmount value) {
this.value = value;
}
}
{code}
i've modified CompositeUserTypeTest.testCompositeUserType (present in hibernate tests) as following (added the last two lines inside if statement):
{code:title=org.hibernate.test.cut.CompositeUserTypeTest.java|borderStyle=solid}
public void testCompositeUserType() {
Session s = openSession();
org.hibernate.Transaction t = s.beginTransaction();
Transaction tran = new Transaction();
tran.setDescription("a small transaction");
tran.setValue( new MonetoryAmount( new BigDecimal(1.5), Currency.getInstance("USD") ) );
s.persist(tran);
List result = s.createQuery("from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'USD'").list();
assertEquals( result.size(), 1 );
tran.getValue().setCurrency( Currency.getInstance("AUD") );
result = s.createQuery("from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'AUD'").list();
assertEquals( result.size(), 1 );
if ( !(getDialect() instanceof HSQLDialect) ) {
result = s.createQuery("from Transaction txn where txn.value = (1.5, 'AUD')").list();
assertEquals( result.size(), 1 );
result = s.createQuery("from Transaction where value = (1.5, 'AUD')").list();
assertEquals( result.size(), 1 );
result = s.createQuery("from Transaction where value != (1.4, 'AUD')").list();
assertEquals( result.size(), 1 );
}
s.delete(tran);
t.commit();
s.close();
}
{code}
the last assert should succeed because transaction (1.5, 'AUD') isn't equal to (1.4, 'AUD') and i should retrieve the (1.5, 'AUD') but the sql generated has an "AND" instead of an "OR":
{code:title=Generated SQL|borderStyle=solid}
select
transactio0_.id as id0_,
transactio0_.description as descript2_0_,
transactio0_.amount as amount0_,
transactio0_.currency as currency0_
from
Trnsctn transactio0_
where
transactio0_.amount<>1.4
and transactio0_.currency<>'AUD'
{code}
In attachment i provide a patch and the full modified test case.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-5886) Inequality operator (<>) on component/composite-id uses AND instead of OR between atomic fields comparison
by Paizo (JIRA)
Inequality operator (<>) on component/composite-id uses AND instead of OR between atomic fields comparison
----------------------------------------------------------------------------------------------------------
Key: HHH-5886
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5886
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.2.7
Environment: 3.2.7GA, jetty, H2/oracle 11g/DB2 v9
Reporter: Paizo
As described here: [https://forum.hibernate.org/viewtopic.php?f=1&t=1009229&start=0]
given this mapping snippet:
{quote}
<class name="d.p.entityIDMUnit.lim.bl.pom.impl.PPKone" table="PPKone">
<composite-id>
<key-property name="i" type="IntegerType">
<column name="c_i_5b145" precision="19" scale="0"/>
</key-property>
<key-property name="j" type="IntegerType">
<column name="c_j_4534d" precision="19" scale="0"/>
</key-property>
</composite-id>
...
{quote}
and the following HQL:
from d.p.entityIDMUnit.lim.bl.pom.impl.PPKone p where (( ( p <> p ) and ( p.i = 1 ) ))
The SQL where statement looks:
where
*ppkone0_.c_i_5b145<>ppkone0_.c_i_5b145
{color:red} and {color} ppkone0_.c_j_4534d<>ppkone0_.c_j_4534d*
and ppkone0_.c_i_5b145=1
when it should be:
*{color:red}({color}ppkone0_.c_i_5b145<>ppkone0_.c_i_5b145
{color:red} OR {color} ppkone0_.c_j_4534d<>ppkone0_.c_j_4534d{color:red}){color}*
or ppkone0_.c_i_5b145=1
A component/composite-id is different from another one if at least ONE of its fields is different, not only when all the fields are different
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HSEARCH-698) NPE when loading invalid stopwords file
by Sanne Grinovero (JIRA)
NPE when loading invalid stopwords file
---------------------------------------
Key: HSEARCH-698
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-698
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.3.0.Final
Reporter: Sanne Grinovero
Priority: Trivial
Fix For: 3.4.0.Alpha1
It seems that when I define an Analyzer needing a resourcefile, like a file containing the stopwords, and this file doesn't exist, a NullPointerException is thrown instead of saying that the file was not found.
{code}[java] Caused by: org.hibernate.HibernateException: could not init listeners
[java] at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
[java] at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1983)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
[java] ... 4 more
[java] Caused by: java.lang.NullPointerException
[java] at java.io.Reader.<init>(Reader.java:61)
[java] at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
[java] at org.hibernate.search.util.HibernateSearchResourceLoader.getLines(HibernateSearchResourceLoader.java:63)
[java] at org.apache.solr.analysis.BaseTokenStreamFactory.getWordSet(BaseTokenStreamFactory.java:109)
[java] at org.apache.solr.analysis.StopFilterFactory.inform(StopFilterFactory.java:50)
[java] at org.hibernate.search.impl.SolrAnalyzerBuilder.injectResourceLoader(SolrAnalyzerBuilder.java:112)
[java] at org.hibernate.search.impl.SolrAnalyzerBuilder.buildAnalyzer(SolrAnalyzerBuilder.java:88)
[java] at org.hibernate.search.impl.ConfigContext.buildAnalyzer(ConfigContext.java:249)
[java] at org.hibernate.search.impl.ConfigContext.initLazyAnalyzers(ConfigContext.java:217)
[java] at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:405)
[java] at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:262)
[java] at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:144)
[java] at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:150)
[java] at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
[java] at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
[java] at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
[java] ... 7 more
{code}
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (ANN-687) orm.xml - cleanup respecting column names
by darren hartford (JIRA)
orm.xml - cleanup respecting column names
-----------------------------------------
Key: ANN-687
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-687
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.0.ga
Environment: mysql 5, MS SQL 2000, Win2000, hibernate 3.2.4
Reporter: darren hartford
couple of issues with orm.xml mapping file that is not fully implemented and needs cleanup.
many-to-many table mapping not respecting column names.
http://forum.hibernate.org/viewtopic.php?t=982330
id-class not respecting column names (end of an old issue, repeated with different scenario).
http://opensource.atlassian.com/projects/hibernate/browse/ANN-361
<id-class class="MyTestId"/>
<attributes>
<id name="compoundOne">
<column name="COMPOUND_ONE"/>
</id>
<id name="compoundTwo">
<column name="COMPOUND_TWO"/>
</id>
...
WARNING: Preparing the statement failed: Invalid column name 'compoundOne'.
WARNING: Preparing the statement failed: Invalid column name 'compoundTwo'.
==========
Use case and urgency of issue related to external technology integration.
-DTO should not require hibernate-annotations to be used in client-code, but is required when using annotations. orm.xml approach removes this limitation.
-GWT 1.4 does not work with java 1.5/annotated DTO. Although everyone keeps pushing it off saying 'GWT 1.5 is on the way', it is not and solutions that should have been working to work around that limitation need to be working correctly.
--
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
15 years, 1 month