[Hibernate-JIRA] Created: (HHH-6801) UUIDBinaryType generates column of type BINARY(255) instead of BINARY(16) in MySQL
by Artem Gelun (JIRA)
UUIDBinaryType generates column of type BINARY(255) instead of BINARY(16) in MySQL
----------------------------------------------------------------------------------
Key: HHH-6801
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6801
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.8
Environment: MySQL 5.1 InnoDB
Custom dialect (see HHH-6800)
Reporter: Artem Gelun
Property definition:
{code:xml}
<property access="field" name="uuid" not-null="true" type="uuid-binary">
<column name="MI_UUID" not-null="true"/>
</property>
{code}
Debug:
{code}
00:13:35,312 DEBUG SchemaExport:415 - create table PCS_MI (MI_CONTAINER bigint not null, MI_ID integer not null, MI_CODE varchar(255), MI_NAME varchar(255), MI_DESCRIPTION varchar(255), MI_TYPE bigint, MI_STATE_CALC_RULE varchar(255), MI_STATE_DICT bigint, MI_EMERG_CALC_RULE varchar(255), MI_ISACTIVE bit default true not null, MI_PARENT_CONTAINER bigint, MI_PARENT_ID integer, MI_UUID binary(255) not null, primary key (MI_CONTAINER, MI_ID)) ENGINE=InnoDB
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-5743) Criteria isMember() creates broken SQL in joined queries
by David Momper (JIRA)
Criteria isMember() creates broken SQL in joined queries
--------------------------------------------------------
Key: HHH-5743
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5743
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0, 3.6.1
Environment: Hibernate 3.6.0,3.6.1, all databases
Reporter: David Momper
Priority: Critical
Attachments: Test.zip
This problem occurred both when using Oracle, or Derby. I assume it occurs for all databases. I also ran my test case with EclipseLink, and the test passed.
A criteria query like this:
{quote}
CriteriaQuery<Group> groupQuery = cb.createQuery(Group.class);
Root<Group> gRoot = groupQuery.from(Group.class);
//Get all groups whose leader's name is John, and has a valid visa for given country
groupQuery.where(cb.and(
cb.like(gRoot.get(Group_.groupLeader)
.get(Person_.personName), "%John%"),
cb.isMember(country,
gRoot.get(Group_.groupLeader)
.get(Person_.validVisas)
)
));
{quote}
produces the following query:
{quote}
select
group0_.GROUP_ID as GROUP1_2_,
group0_.LEADER_ID as LEADER3_2_,
group0_.GROUP_NAME as GROUP2_2_
from
GROUPS group0_,
PERSON person1_
where
group0_.LEADER_ID=person1_.PERSON_ID
and (
person1_.PERSON_NAME like ?
)
and (
? in (
select
person1_.PERSON_ID
from
PERSON person1_
)
)
{quote}
The query fails because a (character) country code is being checked for inclusion in a subquery of (int) person ids.
The subselect in the above query should be on a country, not a person. I think the whole query should look like this:
{quote}
select
group0_.GROUP_ID as GROUP1_2_,
group0_.LEADER_ID as LEADER3_2_,
group0_.GROUP_NAME as GROUP2_2_
from
GROUPS group0_,
PERSON person1_
where
group0_.LEADER_ID=person1_.PERSON_ID
and (
person1_.PERSON_NAME like ?
)
and (
? in (
select
country3_.COUNTRY_CODE
from
PERSON person1_,
PERSON_COUNTRY_VISA validvisas2_,
COUNTRY country3_
where
group0_.LEADER_ID=person1_.PERSON_ID
and person1_.PERSON_ID=validvisas2_.PERSON_ID
and validvisas2_.COUNTRY_CODE=country3_.COUNTRY_CODE
)
)
{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
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-6405) setFetchMode ignored in certain cases when using criteria queries
by David Mansfield (JIRA)
setFetchMode ignored in certain cases when using criteria queries
-----------------------------------------------------------------
Key: HHH-6405
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6405
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 4.0.0.Beta2, 3.6.5
Reporter: David Mansfield
Description:
Setting join type (e.g.) criteria.setJoinType("association.path", FetchType.JOIN) is ignored if the association being set is one of a few types. I believe many-to-many, and any association off of a collection-of-component. For these types of associations, the specified fetch type is ignored.
This worked in prior versions.
This has nothing to do with having additional restrictions on the same association, which is a different issue altogether.
Technical analysis:
This regression was introduced in git commit fbae6db0abaeb6f050ee97ce53d09d74886a7e47, and the fix for a possibly related issue in git commit 1c556dc775708706b6ca84251cb170d3c46f729f was not a complete fix, or rather did not fix this case scenario.
The first referenced commit split the JoinWalker.getJoinType(...) api into two methods, one with more parameters. In the base class implementation, one method or the other is called based on the type of association (see above). However, in the CriteriaJoinWalker (a subclass), the existing implementation only overrode one of these two methods, (the one with more arguments) causing calls into the other method to be handled by the base class, which did not function appropriately.
The second referenced commit introduced an override for the second method, however the implementation was incomplete, and was missing the crucial piece, specifically:
FetchMode fetchMode = translator.getRootCriteria().getFetchMode( path.getFullPath() );
which examined the explicitly set join types in the translator.
A fix will be supplied on github for 3.6.x and 4.0.
The implementation re-unifies the two methods in the CriteriaJoinWalker, using if/else to delegate to the correct super.getJoinType(...) method as appropriate.
--
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
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-6328) Hibernate's "Table" annotations does not cooperate well with custom quoting naming strategy
by Richard Eckart de Castilho (JIRA)
Hibernate's "Table" annotations does not cooperate well with custom quoting naming strategy
-------------------------------------------------------------------------------------------
Key: HHH-6328
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6328
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.6.5
Reporter: Richard Eckart de Castilho
I have implemented a custom QuotingNamingStrategy that quotes table names, so that they are properly treated as case sensitive and to avoid issues with reserved names.
I also have auxiliary "Table" annotations to have Hibernate create indexes on my behalf. Of course the table name is not quoted in these annotations:
{code}
@org.hibernate.annotations.Table(appliesTo="MyTable",indexes = { @Index(name="column1", columnNames="column2")})
{code}
Now I get the exception:
{noformat}
org.hibernate.AnnotationException: @org.hibernate.annotations.Table references an unknown table: MyTable
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:877)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
{noformat}
Debugging the issue, I find that the EntityBinder tries to match the quoted name against the "appliesTo" attribute of the Table annotation, but the value of this attribute is not processed by my custom QuotingNamingStrategy. Thus, the table cannot be found:
{code}
public void processComplementaryTableDefinitions(org.hibernate.annotations.Table table) {
//comment and index are processed here
if ( table == null ) return;
String appliedTable = table.appliesTo();
Iterator tables = persistentClass.getTableClosureIterator();
Table hibTable = null;
while ( tables.hasNext() ) {
Table pcTable = (Table) tables.next();
// -=> Here the quoted name is compared to the unquoted name from "appliedTable"
if ( pcTable.getQuotedName().equals( appliedTable ) ) {
//we are in the correct table to find columns
hibTable = pcTable;
break;
}
hibTable = null;
}
if ( hibTable == null ) {
//maybe a join/secondary table
for ( Join join : secondaryTables.values() ) {
if ( join.getTable().getQuotedName().equals( appliedTable ) ) {
hibTable = join.getTable();
break;
}
}
}
if ( hibTable == null ) {
throw new AnnotationException(
"@org.hibernate.annotations.Table references an unknown table: " + appliedTable
);
}
if ( !BinderHelper.isEmptyAnnotationValue( table.comment() ) ) hibTable.setComment( table.comment() );
TableBinder.addIndexes( hibTable, table.indexes(), mappings );
}
{code}
I do believe that the value of the "appliedTo" attribute should be passed through the naming strategy before comparing against the table name.
--
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
12 years, 8 months