[Hibernate-JIRA] Created: (HHH-6253) Registered function not being called
by Sebastian H. (JIRA)
Registered function not being called
------------------------------------
Key: HHH-6253
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6253
Project: Hibernate Core
Issue Type: Bug
Components: core, query-hql
Affects Versions: 3.6.4, 3.6.3
Reporter: Sebastian H.
Using the following SQL Dialect
public class ServiceAppMySQL5InnoDBDialect extends MySQL5InnoDBDialect {
public ServiceAppMySQL5InnoDBDialect() {
super();
registerFunction("bitwise_and", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "(?1 & ?2)"));
registerFunction("hasflags", new SQLFunctionTemplate(StandardBasicTypes.BOOLEAN, "?1 & ?2 = ?2"));
}
}
and HQL query
Query q = em
.createQuery(
"SELECT o FROM "
+ entityClass.getName()
+ " o WHERE hasflags(o.status, :status)")
.setParameter("email", username)
.setParameter("status", status.getBitmask());
results in the following exception
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: ( near line 1, column 50 [SELECT o FROM tv.px.domain.Owner o WHERE hasflags(o.status, :status)]
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.analyze(QueryTranslatorImpl.java:261)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
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:124)
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:1770)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-6260) Bug with @Min and @Max constraints in TypeSafeActivator for PostgreSQL
by Roman Boroday (JIRA)
Bug with @Min and @Max constraints in TypeSafeActivator for PostgreSQL
----------------------------------------------------------------------
Key: HHH-6260
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6260
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Alpha3, 3.6.4
Reporter: Roman Boroday
Not sure why validation annotation is enforced against database schema at all, but the current code like
String checkConstraint = col.getName() + ">=" + min;
breaks the whole database generation in PostgreSQL if any of the @Min, @Max or @Range validation are used at the moment.
When these annotations are applied to a property, for example:
@Min(value = 0)
private int testValue;
and PostgreSQL dialect is used for the schema generation, the next sample SQL code is created:
CREATE TABLE "TestEntity" (
"testValue" int4 not null check(testValue >= 0)
)
Which fails with an error that "testvalue" column is not found.
The problem is that the check constraint doesn't have quotes around the corresponding column name.
Code like
CREATE TABLE "TableA" (
"testValue" int4 not null check("testValue" >= 0)
)
would work just fine.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-6256) persistence.xml-specified javax.persistence.lock.timeout is ignored
by Andrei Badea (JIRA)
persistence.xml-specified javax.persistence.lock.timeout is ignored
-------------------------------------------------------------------
Key: HHH-6256
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6256
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.3
Reporter: Andrei Badea
With this {{persistence.xml}}
{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<persistence ...>
<persistence-unit name="foo" transaction-type="RESOURCE_LOCAL">
<properties>
...
<property name="javax.persistence.lock.timeout" value="60000"/>
</properties>
</persistence-unit>
</persistence>
{noformat}
the following code displays a value of "-1" for "javax.persistence.lock.timeout".
{noformat}
EntityManagerFactory emf = Persistence.createEntityManagerFactory("foo");
EntityManager em = emf.createEntityManager();
System.out.println(em.getProperties());
{noformat}
Note how {{EntitytManagerFactoryImpl.createEntityManager()}} passes a null map, so the EMF properties are not passed to the EM.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-6255) SchemaExport quote foreignkey names not correct
by Christoph Henniger (JIRA)
SchemaExport quote foreignkey names not correct
-----------------------------------------------
Key: HHH-6255
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6255
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.4, 3.6.3, 3.6.2
Reporter: Christoph Henniger
Attachments: foreignkey.patch
the attached below patch will fix this issue:
@@ -58,7 +58,7 @@ public class ForeignKey extends Constraint {
i++;
}
String result = dialect.getAddForeignKeyConstraintString(
- constraintName, cols, referencedTable.getQualifiedName(dialect, defaultCatalog, defaultSchema), refcols, isReferenceToPrimaryKey()
+ dialect.quote(constraintName), cols, referencedTable.getQualifiedName(dialect, defaultCatalog, defaultSchema), refcols, isReferenceToPrimaryKey()
);
return cascadeDeleteEnabled && dialect.supportsCascadeDelete() ?
result + " on delete cascade" :
--
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
13 years, 7 months