[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4073?page=c...
]
Adam Warski resolved HHH-4073.
------------------------------
Resolution: Fixed
Fix Version/s: 4.0.0.Alpha3
3.6.4
Fixed in trunk and 3.6 branch.
Excellent patch, thanks to Ćukasz Antoniak! Keep them coming (I know, I have one pending
;) )
Adam
discriminator formula creates problem in hibernate envers
---------------------------------------------------------
Key: HHH-4073
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4073
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.x
Environment: hibernate-3.3.x, envers-1.2.1.ga-hibernate-3.3.jar (Oracle 10g or
HSQLDB)
Reporter: Saravana Kumar
Assignee: Adam Warski
Fix For: 3.6.4, 4.0.0.Alpha3
Original Estimate: 56h
Remaining Estimate: 56h
I map my classes using Single Table per class hierarchy as below
@Entity
@DiscriminatorFormula ("(select t.c_type from t_type t where t.c_id =
c_type)")
@Audited
public class Attribute...{
...
}
or
<discriminator type="string">
<formula>(select t.c_type from t_type t where t.c_id = c_type)</formula>
</discriminator>
When I use envers
I get the follwoing error
Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula
at
org.hibernate.envers.configuration.metadata.MetadataTools.addColumns(MetadataTools.java:154)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateMappingData(AuditMetadataGenerator.java:263)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:345)
at
org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:87)
at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:86)
at
org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:260)
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)
When I tried to debug the problem
(AuditMetadataGenerator.java:263) has
260: // Checking if there is a discriminator column
261: if (hasDiscriminator) {
262: Element discriminator_element =
class_mapping.addElement("discriminator");
263: MetadataTools.addColumns(discriminator_element,
pc.getDiscriminator().getColumnIterator());
264: discriminator_element.addAttribute("type",
pc.getDiscriminator().getType().getName());
265: }
(MetadataTools.java:154) has
152: public static void addColumns(Element any_mapping, Iterator<Column>
columns) {
153: while (columns.hasNext()) {
154: Column column = columns.next();
155: addColumn(any_mapping, column.getName(), column.getLength(),
column.getScale(), column.getPrecision(),
156: column.getSqlType());
157: }
158: }
I see that there is nothing to handle Formula :-(
Can you investigate?
--
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