[Hibernate-JIRA] Created: (HHH-4966) Entity Manager bug with ParameterExpressionImpl
by jean-claude cote (JIRA)
Entity Manager bug with ParameterExpressionImpl
-----------------------------------------------
Key: HHH-4966
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4966
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-CR-1
Reporter: jean-claude cote
Emmanuel
There seems to be a bug with the ParameterExpressionImpl class when rendering.
If you create a criteria query using a ParameterExpression instance in
multiple places in your query the rendering of this query will produce
multiple pram0, param1, param2 for the same ParameterExpression
instance.
We fixed this bug by augmenting the RenderingContext interface with
generateParameterName(Expression<?> exp). With this information the
rendering context can give back the same jpaqlParameterName for the
same ParameterExpression instance. All it has to do is do a lookup in
its explicitParamtermapping map.
Thanks
Jean-Claude
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-5006) hibernate.globally_quoted_identifiers=true and Annotations tests
by Stephan Palm (JIRA)
hibernate.globally_quoted_identifiers=true and Annotations tests
----------------------------------------------------------------
Key: HHH-5006
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5006
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.5.0-CR-2
Environment: eclipse galileo
jdk 1.6
Server library JBoss 6.0 M2
(actually I don`t think you need any of this information)
Reporter: Stephan Palm
If I use hibernate.globally_quoted_identifiers=true in order to quote all identifiers, then the mapping for column names breakes if I have a column with a @Column annotation but without a @Column(name=<COLUMN_NAME>). The mapping for the column name then turns out to be ``. Which leads to problems when creating new tables.
I was able to track the error back to
{code}
final String columnName = nameNormalizer.normalizeIdentifierQuoting( col.name() );
{code}
from Ejb3Column.java.
col.name() returns an empty string because the name was not explicitly set.
nameNormalizer.normalizeIdentifierQuoting( col.name() ) then makes `` from the empty string.
I was able to fix this problem by adding a guard to the nameNormalizer.normalizeIdentifierQuoting function:
{code}
if ( identifier.length() == 0)
return null;
{code}
The function now looks like this:
{code}
public String normalizeIdentifierQuoting(String identifier) {
if ( identifier == null ) {
return null;
}
if ( identifier.length() == 0)
return null;
// Convert the JPA2 specific quoting character (double quote) to Hibernate's (back tick)
if ( identifier.startsWith( "\"" ) && identifier.endsWith( "\"" ) ) {
return '`' + identifier.substring( 1, identifier.length() - 1 ) + '`';
}
// If the user has requested "global" use of quoted identifiers, quote this identifier (using back ticks)
// if not already
if ( isUseQuotedIdentifiersGlobally() && ! ( identifier.startsWith( "`" ) && identifier.endsWith( "`" ) ) ) {
return '`' + identifier + '`';
}
return identifier;
}
{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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5171) Allow usage of standalone @JoinFormula annotation
by Sharath Reddy (JIRA)
Allow usage of standalone @JoinFormula annotation
-------------------------------------------------
Key: HHH-5171
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5171
Project: Hibernate Core
Issue Type: Improvement
Components: annotations
Affects Versions: 3.6
Reporter: Sharath Reddy
Assignee: Sharath Reddy
Fix For: 3.6
If there is a single-column join (based on formula) between 2 entities, it is overkill to wrap the @JoinFormula within a @JoinColumnsOrFormulas annotation:
@ManyToOne
@JoinColumnsOrFormulas(
{ @JoinColumnOrFormula(formula=@JoinFormula(value="SUBSTR(product_idnf, 1, 3)", referencedColumnName="product_idnf")) })
The above annotation is powerful, because it gives us the flexibility of using an arbitrary combination of columns and formulas for the join, but in this case it is redundant.
If would be easier to just specify like this:
@ManyToOne
@JoinFormula(value="SUBSTR(product_idnf, 1, 3)", referencedColumnName="product_idnf")) })
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-5042) TableGenerator does not increment hibernate_sequences.next_hi_value anymore after having exhausted the current lo-range
by Guenther Demetz (JIRA)
TableGenerator does not increment hibernate_sequences.next_hi_value anymore after having exhausted the current lo-range
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-5042
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5042
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-CR-2, 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1
Environment: Hibernate: 3.5 , db: HSQLDB (not relevant)
Reporter: Guenther Demetz
Priority: Critical
Attachments: TestTableGenerator.java
This bug is new in 3.5
In version 3.5 class MultipleHiLoPerTableGenerator.java was modified introducing a
new increment variable
IntegralDataTypeHolder value;
along with
int lo;
The problem in the new code is that only value get's incremented whilst variable lo
is still used to check when a new hiVal must be obtained.
if ( lo > maxLo ) {
IntegralDataTypeHolder hiVal = (IntegralDataTypeHolder) doWorkInNewTransaction( session );
as lo is never incremented, MultipleHiLoPerTableGenerator continues to deliver numbers without ever update
hibernate_sequences.next_hi_value on the database (only one unique update is propagates at the first insert)
This lead to duplicate keys as soon another session from another sessionfactory tries to insert new objects on the concerning table.
Please see attached testcase.
IMPORTANT ADVICE TO RUN THE TESTCASE:
as the testcase uses 2 sessionfactories hibernate.hbm2ddl.auto=create cannot be used!!
Schema has to be exported separately and the testcase must run without hbm2ddl.auto property!
Here the schema for HSQLDB:
create table A (oid bigint not null, name varchar(255), version integer not null, primary key (oid), unique (name))
create table hibernate_sequences ( sequence_name varchar(255), sequence_next_hi_value integer )
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-4991) ManyToMany table not joined due to max_join_depth parameter, results to SQL exceptions
by Sergii Novotarskyi (JIRA)
ManyToMany table not joined due to max_join_depth parameter, results to SQL exceptions
--------------------------------------------------------------------------------------
Key: HHH-4991
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4991
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.5.0-CR-2
Environment: Hibernate 3.5.0-CR-2, MacOS X, MySQL 5.1
Reporter: Sergii Novotarskyi
Attachments: Example.zip
*max_join_depth* parameter prevents Hibernate from joining one end of ManyToMany relationship when using Criteria API, if the relationship is "far" enough from the root entity.
{quote}
Criteria c = session.createCriteria(SubEntity.class)
.createAlias("entity", "e") // ManyToOne, inner join
.createAlias("e.entity", "ee") // ManyToOne, inner join
.createAlias("ee.sides", "s") // ManyToMany, inner join + left outer join
.setProjection(Projections.count("id"))
.add(Restrictions.ne("s.data", "abc"));
{quote}
When *max_join_depth* is set to *2* (default) the above example generates following SQL query
{quote}
select count(this_.sub_id) as y0_ from SubEntity this_
inner join SubMainEntity e1_ on this_.submain_id=e1_.submain_id
inner join MainEntity ee2_ on e1_.main_id=ee2_.main_id
inner join MainSide sides7_ on ee2_.main_id=sides7_.main_id
where s3_.data<>?
{quote}
The query, naturally, throws the "Unknown column 's3_.data' in 'where clause'" exception.
Expected query would be
{quote}
select count(this_.sub_id) as y0_ from SubEntity this_
inner join SubMainEntity e1_ on this_.submain_id=e1_.submain_id
inner join MainEntity ee2_ on e1_.main_id=ee2_.main_id
inner join MainSide sides7_ on ee2_.main_id=sides7_.main_id
left outer join SideEntity s3_ on sides7_.side_id=s3_.side_id
where s3_.data<>?
{quote}
--
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, 5 months