[Hibernate-JIRA] Created: (HHH-3420) MatchMode doesn't escape wildcard characters
by Hontvári József (JIRA)
MatchMode doesn't escape wildcard characters
--------------------------------------------
Key: HHH-3420
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3420
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.2
Environment: MySQL
Reporter: Hontvári József
Priority: Minor
One can think that by specifying e.g. MatchMode.START in a "like" restriction Hibernate takes care of escaping SQL LIKE wildcard characters in the supplied pattern. It doesn't, actually Hibernate only inserts a % before the first character.
I am not sure what was the intent of the original author (Gavin King), so the issue may only be missing documentation. However I don't see any other useful purpose of this class then providing database independent escaping. It seems that all databases use the % wildcard, so there is no need to provide database indpeendence to that.
It can be argued that this might create a security problem for an unaware developer, so I set issue type to bug.
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-3499) NamingStrategy should support naming foreign keys and indexes
by Geoffrey De Smet (JIRA)
NamingStrategy should support naming foreign keys and indexes
-------------------------------------------------------------
Key: HHH-3499
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3499
Project: Hibernate Core
Issue Type: Improvement
Components: metamodel
Affects Versions: 3.3.1
Reporter: Geoffrey De Smet
hbm2ddl always generates foreign key constraints based on hashcodes, like this:
alter table apple add index FK365FA4BB24B1D45C (lemon_id), add constraint FK365FA4BB24B1D45C foreign key (lemon_id) references lemon (id);
Some databases don't support enough characters for foreign key names to generate a readable foreign key name, so that's a sensible default.
However, those of use that use databases like MySQL etc, would like a readable foreign key name, such as:
alter table apple add index FK_Apple_lemon (lemon_id), add constraint FK365FA4BB24B1D45C foreign key (lemon_id) references lemon (id);
We can do that by annotating every entity with @Index in JPA, or specifying it in a hbm file,
but we can't do it generally, by extending DefaultNamingStrategy or ImprovedNamingStrategy.
Here's a proposition on how we could do it:
- In the NamingStrategy interface, next to the method foreignKeyColumnName, add a method:
public String foreignKeyConstraintName(String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName
- DefaultNamingStrategy and ImprovedNamingStrategy should implement it as it is now, based on hashcodes.
- If a mapping has an @Index JPA annotation or it's specified in a hbm file, that override counts.
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-3773) NPE when generating schema containing OneToMany relations
by Tobias Hill (JIRA)
NPE when generating schema containing OneToMany relations
----------------------------------------------------------
Key: HHH-3773
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3773
Project: Hibernate Core
Issue Type: Bug
Components: envers
Reporter: Tobias Hill
I have an entity P having a one-to-many relation to an entity C.
I mark P as @Audited.
I do not mark C as @Audited.
Neither do I mark the field containing the relation from P to Cs.
When building the schema I get:
java.lang.NullPointerException
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addOneToManyAttached(CollectionMetadataGenerator.java:164)
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(CollectionMetadataGenerator.java:150)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:141)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:161)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:385)
If I mark C as @Audited it goes away and the schema is generated as supposed to.
--
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
15 years, 7 months