[Hibernate-JIRA] Created: (HHH-5288) Envers auditReader.find() returns wrong data for embedded components using fields with default values
by Erik-Berndt Scheper (JIRA)
Envers auditReader.find() returns wrong data for embedded components using fields with default values
-----------------------------------------------------------------------------------------------------
Key: HHH-5288
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5288
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.2, 3.5.1, 3.5.0-Final
Reporter: Erik-Berndt Scheper
I have found that using auditReader.find() to retrieve audit information for entities containing embedded components with default values. This is a regression issue (also occurs in 1.2.2.GA release of Envers - Hibernate 3.3 compatible, but did not occur not in 1.2.1 GA) that started occurring since HHH-3957.
Sample entity and embeddable:
{code:title=DefaultValueComponentTestEntity.java|borderStyle=solid}
@Id
@GeneratedValue
private Integer id;
@Embedded
@Audited
@AttributeOverrides( { @AttributeOverride(name = "comp2.str1", column = @Column(name = "COMP2_STR1")) })
private DefaultValueComponent1 comp1 = null;
{code}
{code:title=DefaultValueComponent1.java|borderStyle=solid}
private String str1;
@Embedded
private DefaultValueComponent2 comp2 = new DefaultValueComponent2();
{code}
{code:title=DefaultValueComponent2.java|borderStyle=solid}
private String str1 = "defaultValue";
private String str2;
{code}
When I try to persist an instance of DefaultValueComponentTestEntity, with comp1 = null and subsequently call auditReader.find(), an instance is returned where:
{noformat} "defaultValue".equals(comp1.comp2.str1){noformat}
(using java bean notation for simplicity).
I will attach a complete testcase.
--
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: (HHH-5309) @IndexColumn + EagerFetch results in HibernateException
by Douglas Ferguson (JIRA)
@IndexColumn + EagerFetch results in HibernateException
-------------------------------------------------------
Key: HHH-5309
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5309
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1
Reporter: Douglas Ferguson
If you query an entity that has a list with (@IndexColumn and Eager) and this list is empty there is an Exception.
It appears that the code is verifying that the index column it not null, but in this case the index column is null because the left join will bring back a null because the list empty...
The stack Trace:
org.hibernate.HibernateException:null index column for collection: <<EntityClass>>
org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:771)
org.hibernate.collection.PersistentList.readFrom(PersistentList.java:402)
org.hibernate.loader.Loader.readCollectionElement(Loader.java:1052)
org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
org.hibernate.loader.Loader.doQuery(Loader.java:745)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
org.hibernate.loader.Loader.doList(Loader.java:2294)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
org.hibernate.loader.Loader.list(Loader.java:2167)
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
--
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: (HHH-3002) database field name 'version' causes ClassCastException while building session factory
by Patrick Burke (JIRA)
database field name 'version' causes ClassCastException while building session factory
--------------------------------------------------------------------------------------
Key: HHH-3002
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3002
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Java 1.6.0_03, MySQL 5.0.41
Reporter: Patrick Burke
Attachments: out.hib4
When a database table contains a field named 'version', like his one:
DROP TABLE IF EXISTS `tester`.`software_package`;
CREATE TABLE `tester`.`software_package` (
`software_id` int(11) NOT NULL auto_increment,
`version` varchar(100) default NULL,
`name` varchar(100) default NULL,
`root_file_id` int(11) default NULL,
PRIMARY KEY (`software_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
The following error is thrown:
[java] Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at util.HibernateUtil.<clinit>(Unknown Source)
[java] at events.EventManager.listNodes(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
[java] at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:84)
[java] at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:168)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
[java] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
[java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
[java] ... 3 more
--
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: (HHH-4968) Cannot deactivate default BeanValidationListener independently of DDL constraints generation
by Vladimir Klyushnikov (JIRA)
Cannot deactivate default BeanValidationListener independently of DDL constraints generation
--------------------------------------------------------------------------------------------
Key: HHH-4968
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4968
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.5.0-CR-2
Environment: Hibernate 3.5.0-CR-2, Hibernate Validator 4.0.2.GA
Reporter: Vladimir Klyushnikov
Hi,
I need to configure my custom BeanValidationListener instance through Spring, but I cannot deactivate default BeanValidationListener instance. It can be switched off only with DDL constraint generation. When I provide *DDL* value for *javax.persistence.validation.mode* it still activates default BeanValidationListener. When I provide *NONE* value it switches off both BeanValidationListener and DDL constraints. This is because of following code in *BeanValidationListener.java*:
{code}
public static void activateBeanValidation(EventListeners eventListeners, Properties properties) {
...
if ( modes.contains( ValidationMode.NONE ) ) return;
...
}
{code}
It should be changed to following:
{code}
if (!(modes.contains(ValidationMode.CALLBACK) || modes.contains( ValidationMode.AUTO))) return;
{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
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-5195) FilterImpl.validate() throws NullPointerExeption at line 164
by Savochkin Alexander (JIRA)
FilterImpl.validate() throws NullPointerExeption at line 164
------------------------------------------------------------
Key: HHH-5195
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5195
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Environment: hibernate-distribution-3.5.1-Final-dist
Reporter: Savochkin Alexander
After deserialization NPE is thrown at this line
FilterImpl
{code}
line:164
Iterator itr = definition.getParameterNames().iterator();
{code}
the last lines from stack trace are:
{code}
java.lang.NullPointerException
at org.hibernate.impl.FilterImpl.validate(FilterImpl.java:164)
at org.hibernate.engine.LoadQueryInfluencers.getEnabledFilters(LoadQueryInfluencers.java:109)
at org.hibernate.impl.SessionImpl.readObject(SessionImpl.java:2144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:986)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1865)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:364)
{code}
Looking at SessionImpl class we see:
{code}
line 2143:
Iterator iter = loadQueryInfluencers.getEnabledFilters().values().iterator();
while ( iter.hasNext() ) {
( ( FilterImpl ) iter.next() ).afterDeserialize( factory );
}
{code}
LoadQueryInfluencers:
{code}
line:105
Iterator itr = enabledFilters.values().iterator();
while ( itr.hasNext() ) {
final Filter filter = ( Filter ) itr.next();
filter.validate();
}
{code}
So, afterDeserialization() on enabled filters method is invoked AFTER getEnabledFilters() method is.
It seems to be the reason why the private TRANSIENT field "definition" of every filter is null at the moment of filter validation!
"definition" field is supposed to be initialized only after validate() is called.
--
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