[Hibernate-JIRA] Created: (HHH-6636) Properties listed inside "<properties>" tag are not audited
by Andrey Kovalev (JIRA)
Properties listed inside "<properties>" tag are not audited
-----------------------------------------------------------
Key: HHH-6636
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6636
Project: Hibernate Core
Issue Type: Bug
Components: envers
Environment: Hibernate 3.6. Found at MySQL 5
Reporter: Andrey Kovalev
Here is how the bug was found:
I am using envers to audit my ParameterToValue entity. Its properties "containerId", "containerType", "parameterId" which do appear as columns in a mapped DB table "values_for_params" (a regular Hibernate table), are missing at the envers generated "values_for_params_AUD" DB table. I need the ability to get historic "value" for given (containerId, containerType, parameterId).
**The ParameterToValue class:**
@Audited
public class ParameterToValue extends BasicValueHolder {
private Long containerId;
private ContainerType containerType;
private Long parameterId;
public ParameterToValue(ContainerID containerId, Long parameterId, Value value) {
super(value);
this.containerId = containerId.getContainerId();
this.parameterId = parameterId;
containerType = containerId.getContainerType();
}
ParameterToValue() {
}
public Long getParameterId() {
return parameterId;
}
public void setParameterId(Long parameterId) {
this.parameterId = parameterId;
}
public Value getValue() {
return value;
}
public void setValue(Value value) {
this.value = value;
}
public Long getContainerId() {
return containerId;
}
public void setContainerId(Long containerId) {
this.containerId = containerId;
}
public ContainerType getContainerType() {
return containerType;
}
public void setContainerType(ContainerType containerType) {
this.containerType = containerType;
}
}
**The Hibernate mapping definition:**
<class name="platform.server.dataservices.model.ParameterToValue" table="values_for_params">
<cache usage="read-write" include="all" />
<id name="id" column="ID">
<generator class="native"/>
</id>
<properties name="uniqueProps" unique="true">
<property name="containerId" index="ParamValsContainerIdIndx"/>
<property name="parameterId" index="ParamValsParamIdIndx"/>
<property name="containerType" column="CONTAINER_TYPE">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">platform.server.dataservices.model.ContainerType</param>
<param name="type">4</param>
<!-- 12 = string, 5 = smallint, 4 = integer, default 4 -->
</type>
</property>
</properties>
<many-to-one name="value" cascade="all" lazy="false" unique="true" index="PRM_VAL_IDX"/>
</class>
**SHOW CREATE TABLE `values_for_params` in MySQL:**
CREATE TABLE `values_for_params` (
ID` bigint(20) NOT NULL AUTO_INCREMENT,
`containerId` bigint(20) DEFAULT NULL,
`parameterId` bigint(20) DEFAULT NULL,
`CONTAINER_TYPE` int(11) DEFAULT NULL,
`value` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `value` (`value`),
UNIQUE KEY `containerId` (`containerId`,`parameterId`,`CONTAINER_TYPE`),
KEY `ParamValsParamIdIndx` (`parameterId`),
KEY `ParamValsContainerIdIndx` (`containerId`),
KEY `PRM_VAL_IDX` (`value`),
KEY `FKE02CB4F981565307` (`value`),
CONSTRAINT `FKE02CB4F981565307` FOREIGN KEY (`value`) REFERENCES `value` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8
**SHOW CREATE TABLE `values_for_params_AUD` in MySQL:**
CREATE TABLE `values_for_params_AUD` (
`ID` bigint(20) NOT NULL,
`REV` int(11) NOT NULL,
`REVTYPE` tinyint(4) DEFAULT NULL,
`value` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`,`REV`),
KEY `FKE093BE4AEB88DFB` (`REV`),
CONSTRAINT `FKE093BE4AEB88DFB` FOREIGN KEY (`REV`) REFERENCES `DesignRevisionEntity` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1460) Inconsistent behavior when using Session.get() with multiple subclasses
by Tim Lark (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1460?page=c... ]
Tim Lark commented on HHH-1460:
-------------------------------
Was this issue really fixed (i.e. a code change made)? I don't see any commit entries.
> Inconsistent behavior when using Session.get() with multiple subclasses
> -----------------------------------------------------------------------
>
> Key: HHH-1460
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1460
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.2
> Environment: Hibernate 3.1.2
> HSQLDB 1.8.0.2
> Java 1.5.0_05-b05
> Reporter: Seth Fitzsimmons
> Assignee: Steve Ebersole
> Fix For: 3.2.1
>
> Attachments: ClassCastException.zip
>
>
> Session.get() loads a cached instance of an alternate subclass with the same PK after that subclass has been loaded directly (throwing a ClassCastException where null was expected). When attempting to load it without prior loading, null is returned, as expected.
> Client and Partner both extend person and have discriminator values of 1 and 2, respectively. There is a single entry in the database (a Client) with a PK of 0.
> This should be null:
> Partner partner = (Partner) getSession().get(Partner.class, 0);
> assertNull(partner);
> It is. However, if the Client is loaded first, Hibernate will attempt to return a Partner (as a Client) where it should not exist:
> Client client = (Client) getSession().get(Client.class, 0);
> assertNotNull(client);
>
> // this should be null, not return a Client object (resulting in a ClassCastException)
> Partner partner = (Partner) getSession().get(Partner.class, 0);
> assertNull(partner);
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Created: (HHH-6121) Hibernate statistics should log at DEBUG level instead of INFO
by Philippe Laflamme (JIRA)
Hibernate statistics should log at DEBUG level instead of INFO
--------------------------------------------------------------
Key: HHH-6121
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6121
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.6
Reporter: Philippe Laflamme
With HHH-3659 came lots of output at INFO level during bulk operations:
{noformat}
2011-04-13 14:16:21,538 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
2011-04-13 14:16:21,538 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
2011-04-13 14:16:21,577 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
2011-04-13 14:16:21,577 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
2011-04-13 14:16:21,626 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
2011-04-13 14:16:21,626 - INFO - hibernate.stat.Statistics - HQL: null, time: 0ms, rows: 0
{noformat}
Hibernate used to be completely silent (except at startup) when set at the INFO level. Now, it is very verbose.
If someone needs query timings they are probably debugging something. This output should probably set at DEBUG level instead of INFO.
--
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, 3 months