[Hibernate-JIRA] Created: (HHH-3216) Incorrect parse result in ParameterParser
by alexandia (JIRA)
Incorrect parse result in ParameterParser
-----------------------------------------
Key: HHH-3216
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: Hibernate 3.1.0, 3.2.6
Any type of database
Reporter: alexandia
A very simple hql will cause the ParameterMetadata.getOrdinalParameterDescriptor() method throw this Exception:
"Remember that ordinal parameters are 1-based!"
HQL:
from User u where u.userName = ? and u.userType = 'call'
The reason is found out to be this: ParameterParser.java
public static void parse(String sqlString, Recognizer recognizer) throws QueryException {
boolean hasMainOutputParameter = sqlString.indexOf( "call" ) > 0 &&
sqlString.indexOf( "?" ) < sqlString.indexOf( "call" ) &&
sqlString.indexOf( "=" ) < sqlString.indexOf( "call" );
The hql above match these conditions, so the hasMainOutputParameter is set to true.
Thus the first normal ordinal parameter is bypassed, exception is thrown.
Suggestion: Strenthen the checking of the hasMainOutputParameter.
--
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
17 years, 6 months
[Hibernate-JIRA] Created: (HHH-2984) Hibernate generates invalid query when using order by through a one-to-one relation, error is "for SELECT DISTINCT, ORDER BY expressions must appear in select list"
by Dobes Vandermeer (JIRA)
Hibernate generates invalid query when using order by through a one-to-one relation, error is "for SELECT DISTINCT, ORDER BY expressions must appear in select list"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2984
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2984
Project: Hibernate3
Issue Type: Improvement
Affects Versions: 3.2.5
Environment: PostgresQL 8.2 and glassfish running in Windows XP Professional
Reporter: Dobes Vandermeer
For this query:
select distinct object(b) from Business b where exists (select bur from BusinessUserRole bur where bur.user = :user and bur.business = b) order by b.contactInformation.name ASC
The following SQL is generated:
Hibernate: select distinct business0_.id as id114_, business0_.contactInformation_id as contactI3_114_, business0_.currency_id as currency2_114_ from Business business0_, ContactInformation contactinf2_ where business0_.contactInformation_id=contactinf2_.id and (exists (select businessus1_.id from BusinessUserRole businessus1_ where businessus1_.user_id=? and businessus1_.business_id=business0_.id)) order by contactinf2_.name ASC limit ?
This causes PostgreSQL to issue the error :
for SELECT DISTINCT, ORDER BY expressions must appear in select list
I can see quite clearly that it is correct that contactinf2_.name does not appear in the select list.
I suppose if the query were not using distinct, this issue would not occur. As a workaround, I can sort the results manually.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HSEARCH-237) IdHashShardingStrategy fails after 1.7M id is generated
by Rafal Glowacz (JIRA)
IdHashShardingStrategy fails after 1.7M id is generated
-------------------------------------------------------
Key: HSEARCH-237
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-237
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.0.0.GA
Reporter: Rafal Glowacz
public class IdShardingStrategyTest extends TestCase
{
private IdHashShardingStrategy _defaultIdStrategy;
private IdShardingStrategy _idStrategy;
protected void setUp() throws Exception {
_idStrategy = new IdShardingStrategy();
_idStrategy.initialize(null, createDirectoryProviders());
_defaultIdStrategy = new IdHashShardingStrategy();
_defaultIdStrategy.initialize(null, createDirectoryProviders());
}
private DirectoryProvider[] createDirectoryProviders() {
return new DirectoryProvider[]{new MockDirectoryProvider(),
new MockDirectoryProvider(),
new MockDirectoryProvider()};
}
public void testIdSharding() {
long id = 1;
long limit = 1000 * 1000000 * 1000000L;
try {
while (id < limit) {
generateForAddition(_idStrategy, id);
generateForDeletion(_idStrategy, id);
id += 129653153;
}
} catch (Exception e) {
fail("Couldn't get directory for id " + id);
}
}
public void testIdHashSharding() {
long id = 1;
long limit = 1000 * 1000000 * 1000000L;
try {
while (id < limit) {
generateForAddition(_defaultIdStrategy, id);
generateForDeletion(_defaultIdStrategy, id);
id += 129653153;
}
fail("Should fail with ArrayIndexOutOfBoundsException for long id");
} catch (Exception e) {
}
}
private MockDirectoryProvider generateForAddition(IndexShardingStrategy strategy, long id) {
return (MockDirectoryProvider) strategy.getDirectoryProviderForAddition(null, id, id + "", null);
}
private DirectoryProvider[] generateForDeletion(IndexShardingStrategy strategy, long id) {
return strategy.getDirectoryProvidersForDeletion(null, id, id + "");
}
}
Workaround:
Returned value is minus for id's bigger then 1.7M so for time being I added check like: return value < 0 ? -1 * value : value; Works fine for me.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-2674) Query using Escape syntax in LIKE expression with PostgresSQL 8.2 results in PSQLException: The column index is out of range
by Shelly McGowan (JIRA)
Query using Escape syntax in LIKE expression with PostgresSQL 8.2 results in PSQLException: The column index is out of range
-----------------------------------------------------------------------------------------------------------------------------
Key: HHH-2674
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2674
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: JBEAP RC6 - 3.2.4.SP1_CP01
Reporter: Shelly McGowan
JPQL:
createQuery(
"select distinct Object(c) FROM Customer c, in(c.aliases) a WHERE a.alias LIKE 'sh\\_ll' escape '\\'")
.setMaxResults(NUMOFCUSTOMERS)
.getResultList();
HIBERNATE: select distinct customer0_.ID as ID3_, customer0_.NAME as NAME3_, customer0_.country as country3_, customer0_.code as code3_, customer0_.FK6_FOR_CUSTOMER_TABLE as FK5_3_, customer0_.FK5_FOR_CUSTOMER_TABLE as FK6_3_ from CUSTOMER_TABLE customer0_ inner join FKS_ALIAS_CUSTOMER aliases1_ on customer0_.ID=aliases1_.FK_FOR_CUSTOMER_TABLE inner join ALIAS_TABLE alias2_ on aliases1_.FK_FOR_ALIAS_TABLE=alias2_.ID where alias2_.ALIAS like 'sh\_ll' escape '\' limit ?
ERROR: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute query
.
.
.
Caused by: org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:52)
at org.postgresql.core.v3.SimpleParameterList.setLiteralParameter(SimpleParameterList.java:113)
at org.postgresql.jdbc2.AbstractJdbc2Statement.bindLiteral(AbstractJdbc2Statement.java:2106)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setInt(AbstractJdbc2Statement.java:1151)
at org.hibernate.loader.Loader.bindLimitParameters(Loader.java:1646)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1566)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3392) Query Cache entries are not distributable
by Greg Luck (JIRA)
Query Cache entries are not distributable
-----------------------------------------
Key: HHH-3392
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3392
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.3.0.CR1
Environment: Any
Reporter: Greg Luck
Steve
It will correct the issue we saw.
On 17/06/2008, at 1:50 AM, Steve Ebersole wrote:
I'm asking for confirmation that said change does in fact correct the
issue :)
If it does I'll make the change in Hibernate...
On Mon, 2008-06-16 at 17:42 +1000, Greg Luck wrote:
Steve
Thanks. Why don't you make the change in Hibernate?
On 14/06/2008, at 2:40 PM, Steve Ebersole wrote:
Considering that RootEntityResultTransformer is not performing an
kind
of data uniqueing (singleton, etc) then yes that would be an issue.
There is nothing wrong with caching a query which uses a
ResultTransformer per-se.
As simple test would be to add an equals() override
to RootEntityResultTransformer where the class of the operands are
evaluated:
public boolean equals(Object other) {
// all RootEntityResultTransformers are considered equal
return other != null
&& RootEntityResultTransformer.class.isInstance( other )
}
On Tue, 2008-06-10 at 14:35 +1000, Greg Luck wrote:
Steve
I have a question from a Hibernate/Ehcache user.
When he replicates a cached Query it does not get hit on the
second
box.
I can see what the trouble is: the key includes an object
reference to
a RootEntityResultTransformer:
; transformer:
org.hibernate.transform.RootEntityResultTransformer@a725aa,
value=[4968486262001664, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
version=1,
hitCount=0, CreationTime = 1213009341528, LastAccessTime = 0 ]
So, this cannot work. How does this work for any distributed
cache?
Begin forwarded message:
From: alvins <alvins1982(a)hotmail.com>
Date: 9 June 2008 9:26:38 PM
To: ehcache-list(a)lists.sourceforge.net
Subject: [ehcache-list] Distributed ehcache - queries
I am having some problems with ehcache in distributed mode and
queries. I
have a simple spring+hibernate+ehcache webapp running on two
tomcat
servers.
I have enabled second level caching and I can see my simple pojo
gets
replicated back and forth fine between the two servers.
The query caching seems to work fine if I have a single server
started. I
can see that is using the cached query and not hitting the db.
However what
I am trying to test is if I have two boxes - box1 does query and
populates
cache which gets replicated to box2 - then box2 doesn't need to
do
query
since its in cache.
My problem is that the query from box1 is not recognized as
being
the same
as on box2 - it seems to get cached multiple times. Below is a
log
snippet
of the two objects which are in my query cache - there should
only
be one.
The first debug line is showing a query object which was
replicated
over
from another box - the second line is showing a query object
which
was
populated locally. This should not happen since they are the
same
query.
21:03:39,763 DEBUG net.sf.ehcache.store.MemoryStore -
findTopXCache:
findTopXMemoryStore hit for sql: select this_.emp_id as
emp1_2_0_,
this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_
from
Employee this_; parameters: ; first row: 0; max rows: 10;
transformer:
org.hibernate.transform.RootEntityResultTransformer@a725aa
LOCAL: [ key = sql: select this_.emp_id as emp1_2_0_,
this_.emp_firstname as
emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_;
parameters: ;
first row: 0; max rows: 10; transformer:
org.hibernate.transform.RootEntityResultTransformer@a725aa,
value=[4968486262001664, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
version=1,
hitCount=0, CreationTime = 1213009341528, LastAccessTime = 0 ]
21:03:39,763 DEBUG net.sf.ehcache.store.MemoryStore -
findTopXCache:
findTopXMemoryStore hit for sql: select this_.emp_id as
emp1_2_0_,
this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_
from
Employee this_; parameters: ; first row: 0; max rows: 10;
transformer:
org.hibernate.transform.RootEntityResultTransformer@aa11a6
LOCAL: [ key = sql: select this_.emp_id as emp1_2_0_,
this_.emp_firstname as
emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_;
parameters: ;
first row: 0; max rows: 10; transformer:
org.hibernate.transform.RootEntityResultTransformer@aa11a6,
value=[4968486194896896, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
version=1,
hitCount=5, CreationTime = 1213009325003, LastAccessTime =
1213009415332 ]
Does anybody have any ideas?
--
View this message in context:
http://www.nabble.com/Distributed-ehcache---queries-tp17730904p17730904.html
Sent from the Ehcache mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
ehcache-list mailing list
ehcache-list(a)lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ehcache-list
Regards
Greg Luck
web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622
Regards
Greg Luck
web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622
Regards
Greg Luck
web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622
--
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
17 years, 7 months