[Hibernate-JIRA] Created: (HHH-5131) SchemaExport drop fails if constraint names change
by Strong Liu (JIRA)
SchemaExport drop fails if constraint names change
--------------------------------------------------
Key: HHH-5131
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5131
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1, 3.3.2
Environment: PostgreSQL
Reporter: Strong Liu
Fix For: 3.3.x, 3.5.x
for PostgreSQL dialect, it doesn't use cascade to drop tables, this may causes error when it drops the constraints.
for example,
there is a table A with a FK which name is "123456"
but schemaUpdate uses a different FK name to drop it, then fails, then it tries to drop Table A, fails again :(
HB-540 was reported a long ago, and Gavin added a comment "We can't apply this patch since older versions of Postgres don't support the cascade syntax."
but I don't think it is still a problem( it was a comment added in 2003), as even the PostgreSQL 7.x support this syntax
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-5032) Setting LockModeType.OPTIMISTIC_FORCE_INCREMENT defaults to only OPTIMISTIC
by Carlos Vara (JIRA)
Setting LockModeType.OPTIMISTIC_FORCE_INCREMENT defaults to only OPTIMISTIC
---------------------------------------------------------------------------
Key: HHH-5032
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5032
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0-CR-2
Environment: Hibernate Core 3.5.0-CR-2, Hibernate Validator 4.1 Snapshot, Spring 3.0.1, JPA2
Reporter: Carlos Vara
Using EntityManager.lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT) doesn't change lock type, and version doesn't get updated on transaction commit.
The following code:
System.out.println("PRE lock mode: " + this.entityManager.getLockMode(an));
this.entityManager.lock(an, LockModeType.OPTIMISTIC_FORCE_INCREMENT);
System.out.println("POST lock mode: " + this.entityManager.getLockMode(an));
Outputs:
PRE lock mode: OPTIMISTIC
POST lock mode: OPTIMISTIC
Debugging AbstractLockUpgradeEventListener.upgradeLock, the reason is it doesn't upgrade it because previous lock mode is "READ" (whose level is 5), and OPTIMISTIC_FORCE_INCREMENT has level 4, so it doesn't trigger the update.
I'm not sure about Hibernate's LockMode, but I think that OPTIMISTIC_FORCE_INCREMENT is a bit more restrictive than just OPTIMISTIC, so the locking type should be upgraded.
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-5078) JPA criteria query numeric expressions produce wrong result (due to wrong bracketing)
by Christoph Gerkens (JIRA)
JPA criteria query numeric expressions produce wrong result (due to wrong bracketing)
-------------------------------------------------------------------------------------
Key: HHH-5078
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5078
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager, query-criteria
Affects Versions: 3.5.0-Final
Environment: Hibernate-Core 3.5.0-Final, all database platforms
Reporter: Christoph Gerkens
The combination of quot and diff results in wrong SQL code. E.g.: (2 - 1) / 2 should be evaluated to 0.5 not 1.5 ( which is 2 - (1 / 2).
JUnit 4 Test:
@Test
public void testJpaCriteriaApiQuoteAndDiff() {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Number> query = cb.createQuery(Number.class);
query.from(SystemUser.class); // entity type doesn't matter, but must contain at least one entry for this test case.
query.select( // (2 - 1) / 2
cb.quot(
cb.diff(
cb.literal(BigDecimal.valueOf(2.0)),
cb.literal(BigDecimal.valueOf(1.0))),
BigDecimal.valueOf(2.0))).distinct(true);
Number result = em.createQuery(query).getSingleResult();
assertEquals(0.5d, result.doubleValue(), 0.1d); // (2 - 1) / 2 = 0.5
}
--
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, 2 months
[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, 2 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, 2 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, 2 months