[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, 8 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, 8 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, 8 months
[Hibernate-JIRA] Created: (HHH-3708) Suboptimal exception on m:n relations with an unaudited entity
by Eike Hirsch (JIRA)
Suboptimal exception on m:n relations with an unaudited entity
--------------------------------------------------------------
Key: HHH-3708
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3708
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1, Envers 3.4-Snapshot, Java 6, Spring 2.5
Reporter: Eike Hirsch
Priority: Minor
The following code will produce a NullPointerException on listener startup when **B** is not audited. The exception should state that there is an audited collection to an unaudited entity. (And for debugging it would be really cool to log both entity class names)
{code}
@ManyToMany( cascade= {CascadeType.ALL} )
public List<B> getBs() {
return bs;
}
{code}
As described in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=148392.
{code}
2009-01-09 16:46:11.872::WARN: Nested in org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicati
onContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateExcepti
on: could not init listeners:
java.lang.NullPointerException
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addValueToMiddleTable(Co
llectionMetadataGenerator.java:380)
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addWithMiddleTable(Colle
ctionMetadataGenerator.java:303)
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(Collection
MetadataGenerator.java:152)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerat
or.java:136)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGe
nerator.java:155)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetad
ataGenerator.java:343)
at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:232)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactory
Bean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFacto
ryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSession
FactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(A
bstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(Abst
ractAutowireCapableBeanFactory.java:1335)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(Abstra
ctAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutow
ireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abstract
AutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.ja
va:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingl
etonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java
:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
85)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
64)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(De
faultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(A
bstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContex
t.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255
)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.j
ava:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:220)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:345)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:286)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:204)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:183)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycl
eExecutor.java:498)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycl
eExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor
.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
{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
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-3741) Join tables are not audited if the join is defined in an abstract
by David Lilley (JIRA)
Join tables are not audited if the join is defined in an abstract
------------------------------------------------------------------
Key: HHH-3741
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3741
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.4
Environment: JBoss 4.2.3
Seam 2.1
Hibernate 3.4
Envers 3.4
PostgreSQL 8.3
Reporter: David Lilley
Attachments: EnversTest.zip
I have an abstract with a one-to-many relationship to to another abstract. I defined a join table and an audit join table for the one-to-many relationship.
The abstract classes are extended to "Set" and "Item" classes using the joined inheritance type. (Set and Item aren't the real names of course; the names have been scrubbed to protect the innocent.)
The tables and audit tables are all created correctly. When I run my tests, the entities and relationship tables are correctly populated, and the entities' audit tables are populated. However, the audit table for the relationships are empty. (i.e., Item, Item_aud, Set, Set_aud, Set_Item all have the proper data, but Set_Item_aud doesn't have any data.)
I tested a non-abstract class that has a similar one-to-many relationship, using the same hibernate annotations, with the same type of join table and audit join table. When I run my tests, all tables are correctly populated - including the join audit table.
Attached is a complete failing test case, with a SEAM test.
--
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, 8 months