[Hibernate-JIRA] Created: (HHH-3813) Automatic flush to the join table before a criteria query
by Maxim Gordienko (JIRA)
Automatic flush to the join table before a criteria query
---------------------------------------------------------
Key: HHH-3813
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3813
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate Core 3.3.1.GA, H2 1.1.108
Reporter: Maxim Gordienko
Attachments: criteriaflush.zip
With the default flush mode Hibernate flushes query regions before queries to run SQL against actual table data.
If two entity are connected using the join table and data is queried using a criteria Hibernate does not flush to the join table.
It flushes to the entity tables though.
The attached test case produces the SQL output
Hibernate: insert into USERS (ID, NAME) values (null, ?)
Hibernate: insert into ITEMS (ID, NAME) values (null, ?)
Hibernate: select this_.ID as ID0_1_, this_.NAME as NAME0_1_, items3_.USER_ID as USER1_, items1_.ID as ITEM2_, items1_.ID as ID2_0_, items1_.NAME as NAME2_0_ from USERS this_ inner join USER_ITEMS items3_ on this_.ID=items3_.USER_ID inner join ITEMS items1_ on items3_.ITEM_ID=items1_.ID where items1_.NAME=?
But it should flush to the USER_ITEMS table before executing the criteria query.
The commented HQL query does flush to both the entity tables and the join table.
The problem is in the org.hibernate.loader.criteria.CriteriaQueryTranslator.getQuerySpaces() method.
It returns only the entity tables.
--
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, 6 months
[Hibernate-JIRA] Created: (HBX-812) Fetching Children of Database _crawls_.
by Syd Poetry (JIRA)
Fetching Children of Database _crawls_.
---------------------------------------
Key: HBX-812
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-812
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta8
Environment: MySQL 5.0, Eclipse 3.2, JDK 1.5, Beta8 for Hibernate Tools
Reporter: Syd Poetry
I just updated a bunch of components for Eclipse (mostly related to Visual Editor); added a couple of tables to my database, went to regenerate all the POJO clases .hbm.xml mapping files, and found that anything that queries the database schema runs abysmally slow.
Updated the tools from beta6 to beta8 thinking it might be a conflict with one of the updates that was performed, still very slow (5+ minutes to retrieve a list of tables!). Deleted all my hibernate-related XML files thinking it might be a parsing error, went to generate a new console file, and revenge.xml, found out that any listbox that tried to access the schema appeared to be hanging. It finishes after much hard-drive crunching. I have 2.2 GBs free running windows XP, MEM usage is 856 MB out of 1.5 GB physical memory. Just out of curiousity, is *anyone* else having this slow response for schema detection? I'm wondering if I have to update another component like a driver or something like that.
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-3362) NullPointerException in org.hibernate.dialect.Dialect$2.getReturnType
by Istvan Kovacs (JIRA)
NullPointerException in org.hibernate.dialect.Dialect$2.getReturnType
---------------------------------------------------------------------
Key: HHH-3362
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3362
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Hibernate Core 3.6.2 GA, hsqldb
Reporter: Istvan Kovacs
Attachments: bug_src.zip
java.lang.NullPointerException
at org.hibernate.dialect.Dialect$2.getReturnType(Dialect.java:85)
at org.hibernate.hql.ast.util.SessionFactoryHelper.findFunctionReturnType(SessionFactoryHelper.java:382)
at org.hibernate.hql.ast.tree.AggregateNode.getDataType(AggregateNode.java:21)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:143)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:705)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:529)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.console.HQLQueryPage.setSession(HQLQueryPage.java:106)
at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:388)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:383)
[...]
3 classes:
Employee: Long ID; String name; Shop shop
Shop: Long ID; String name; Set<Employee> employees; Map<Product, Integer> stock
Product: Long ID; String name
I mapped them to RDBMS using Hibernate. There's a table to hold stock info:
SHOP_PRODUCT_STOCK - has fields SHOP_ID, PRODUCT_ID, AMOUNT
SQL to query the average stock of each product:
select p.name as name, avg(sps.amount) as avg_stock
from Shop s, Shop_Product_Stock sps, Product p
where sps.product_id=p.product_id and sps.product_id=p.product_id
group by p.name
order by p.name;
Attempt in HQL that the produces exception:
select p, avg(s.stock[p])
from Shop s, Product p
group by p
I've also tried SELECTing and GROUPing BY p.id and p.name. None of the three variants work.
--
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, 6 months