[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
13 years, 11 months
[Hibernate-JIRA] Created: (OGM-160) Invalid persistence unit configuration might result in NullPointerException
by Sanne Grinovero (JIRA)
Invalid persistence unit configuration might result in NullPointerException
---------------------------------------------------------------------------
Key: OGM-160
URL: https://hibernate.onjira.com/browse/OGM-160
Project: Hibernate OGM
Issue Type: Bug
Reporter: Sanne Grinovero
Assignee: Sanne Grinovero
Fix For: 4.0-next
If the persistence unit name mentioned in the configuration file is not matching the name passed to the initialization method, the Persistence provider is expected to return null.
The HibernateOgmPersistence is not prepared to deal with null return values from the delegate, and returns instead an unusable EntityManagerFactory.
{code}
Persistence.createEntityManagerFactory( "does-not-exist-PU" );
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HCANN-48) @AccessType. Custom PropertAccessor Hibernate does not work
by Stanislav Zaluzhskiy (JIRA)
@AccessType. Custom PropertAccessor Hibernate does not work
-----------------------------------------------------------
Key: HCANN-48
URL: https://hibernate.onjira.com/browse/HCANN-48
Project: Hibernate Commons Annotations
Issue Type: Bug
Affects Versions: 4.0.1.Final
Environment: Spring 3.1.X
Reporter: Stanislav Zaluzhskiy
Hi,
I'm trying to migrate from Hibernate 3.5.6 to 4.1.1. Faced with several problems one of them is that @AccessType is not working. My custom Getters nad Settors are not called at anytime.
Code example:
@NotNull
@Size(min = PASSWORD_MIN_SIZE, max = MAX_SIZE)
@Pattern(regexp = "((?=.*\\d)(?=.*[a-zA-Zа-яА-Я]).*)",
message = "{javax.validation.constraints.Pattern.password.message}")
@Column(name = "user_password", nullable = false)
@AccessType(value = "com.utils.PasswordPropertyAccessor")
private String password;
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months