[Hibernate-JIRA] Created: (HBX-1144) Weird Column Length problem - new length value in annotation being ignored
by Duncan Kinnear (JIRA)
Weird Column Length problem - new length value in annotation being ignored
--------------------------------------------------------------------------
Key: HBX-1144
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1144
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.0.GA
Environment: Tar file was hibernate-3.2.6.ga.tar. Glassfish version 2.0 ur2. PostgreSQL version 8.x (various)
Reporter: Duncan Kinnear
We are using Hibernate as our persistence layer with NetBeans 6.7.1, EJB3, Glassfish and PostgreSQL.
We have almost 200 tables defined as EJB entities. We use annotations on the entities to define the tables/columns. As we are still in an early testing phase, we regularly drop all the tables in the database and use the Hibernate auto schema update to recreate them.
Recently we changed the length of a standard field that appears in many of our tables. The column is called ID_ORDER and is defined in the entities using the following code:
@Column(name = "ID_ORDER", length = STANDARD_ID_ORDER_LENGTH, nullable = false)
private String idOrder;
where STANDARD_ID_ORDER_LENGTH is defined as a public static final int in the superclass of these tables.
This length used to be 20, but we increased this to 50, recompiled all the affected classes, dropped all the tables and redeployed.
Now, on 2 developer machines this change worked correctly, with the new tables having their ID_ORDER columns all length 50.
However, on the other 2 developer machines, one table (called FEED_TYPE) gets recreated with the ID_ORDER column with length 20. This also occurs when we deploy the resulting EAR file to another server running Glassfish.
We have tried all sorts of things on these machines to try and 'fix' this. We have removed the column completely, recreated the table and it is still there! We have explicitly set the length in the annotation of the column of this one table and the length is always ignored. We have renamed the existing column and deployed, but the new column is always length 20. We have renamed the table and then recreated it - still wrong. We have even dropped the entire database and recreated it, but the length of 20 remains!
We are pulling our hair out on this one, it just doesn't make any sense. Where is hibernate 'caching' the length definition of this one column in one table?
--
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
14 years, 8 months
[Hibernate-JIRA] Created: (HHH-4891) Using certain column names which mirror SQL function names causes "ambiguous column" SQL errors
by Manuel Dominguez Sarmiento (JIRA)
Using certain column names which mirror SQL function names causes "ambiguous column" SQL errors
-----------------------------------------------------------------------------------------------
Key: HHH-4891
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4891
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2
Environment: Error verified with Oracle, MySQL and H2 database engines.
Reporter: Manuel Dominguez Sarmiento
We have some columns names "floor" and "hash". This used to work fine until 3.5.0 Beta 2. This and later releases fail when a query involves a join with two tables and both each contain a column named either "floor" or "hash" with an "ambiguous column" error.
3.5.0 Beta 1 and previous releases work fine. Something must have changed in Beta 2 that is causing some kind of recognition of SQL function names, but I can't seem to pinpoint any issue related to this in the changelong.
I'm pretty sure this would also happen with other column names such as "ceil", "abs", etc. which although they might be SQL function names they are not reserved keywords, and thus they are valid column names.
--
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
14 years, 9 months
[Hibernate-JIRA] Created: (HHH-4541) collection_valued_input_parameter not working in IN statement
by Farrukh Najmi (JIRA)
collection_valued_input_parameter not working in IN statement
-------------------------------------------------------------
Key: HHH-4541
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4541
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0.Beta-1
Reporter: Farrukh Najmi
3.5.0-Beta1 of hibernate-entitymanager supports JPA 2.0.
According to section 4.6.9 of the JPA 2.0 spec an IN statement can have a collection_valued_input_parameter:
"
in_expression ::=
{state_field_path_expression | type_discriminator} [NOT] IN
{ ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }
in_item ::= literal | single_valued_input_parameter
"
When I try the following query:
SELECT DISTINCT Object(p) FROM org.freebxml.omar.jaxb.bindings.rim._4_0.PersonType p, org.freebxml.omar.jaxb.bindings.rim._4_0.AssociationType a WHERE a.sourceObject = :sourceObjectId AND p.id = a.targetObject AND a.type IN :typexxx
with a List<String> value for collection_valued_input_parameter :typexxx I get the following unexpected error:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 226 [SELECT DISTINCT Object(p) FROM org.freebxml.omar.jaxb.bindings.rim._4_0.PersonType p, org.freebxml.omar.jaxb.bindings.rim._4_0.AssociationType a WHERE a.sourceObject = :sourceObjectId AND p.id = a.targetObject AND a.type IN :typexxx ]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1585)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:121)
--
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
14 years, 9 months
[Hibernate-JIRA] Created: (HHH-4922) Incorrect Parsing of IN-Clause in JPQL
by Pierce Wetter (JIRA)
Incorrect Parsing of IN-Clause in JPQL
--------------------------------------
Key: HHH-4922
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4922
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-Beta-4
Environment: 3.5.0-Beta-4, ALL
Reporter: Pierce Wetter
In the reference implementation, a query such as the following:
select u from User u where u.loginName IN :logins
will accept :logins as a parameter of Collection<String>. While:
select u from User u where u.loginName IN (:login1)
will accept :login1 as a String.
For a collection, Hibernate insists on:
select u from User u where u.loginName IN (:logins)
and it throws an error on:
select u from User u where u.loginName IN :logins
But not only does this not match the reference implementation, but it precludes the use of:
select u from User u where u.loginName IN (:login1. :login2, :login3)
That is, is prevents the use of the IN clause with a hard coded set of String values.
Test Case:
It's pretty trivial. Both of these should be allowed:
Query qTwoLogins = em.createQuery(
"select u from User u where ou.loginId in (:login1, :login2)"
);
Query qCollectionLogins = em.createQuery(
"select u from User u where u.login in :logins"
);
qTwoLogins.setParameter("login1","testuser1");
qTwoLogins.setParameter("login2","testuser2");
HashSet<String> list= new HashSet<String>(2);
list.add("testuser1");
list.add("testuser2");
qCollectionLogins.setParameter("logins",list);
--
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
14 years, 9 months
[Hibernate-JIRA] Created: (HHH-4921) 3.5 (JPA 2) doesn't allow order by alias
by Tomasz Bech (JIRA)
3.5 (JPA 2) doesn't allow order by alias
----------------------------------------
Key: HHH-4921
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4921
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-CR-1
Reporter: Tomasz Bech
Attachments: JPAQLComplianceTest.java
I've created following test case in JPAQLComplianceTest.java:
public void testOrderByAlias() {
Session s = openSession();
s.createQuery( "select c.name as myname FROM Item c ORDER BY myname" ).list();
s.close();
}
and it fails:
Caused by: java.sql.SQLException: Column not found: MYNAME in statement [select item0_.NAME as col_0_0_ from EJB3_ITEM item0_ order by myname]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1598)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:271)
at org.hibernate.loader.Loader.doList(Loader.java:2273)
... 30 more
Spec says in '4.9 ORDER BY Clause' that 'order by alias' is supported by JPA 2.
--
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
14 years, 9 months