[Hibernate-JIRA] Created: (HHH-3574) ANY mapping ignores lazy="false"
by Manuel Dominguez Sarmiento (JIRA)
ANY mapping ignores lazy="false"
--------------------------------
Key: HHH-3574
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3574
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Manuel Dominguez Sarmiento
We have a use case for eager fetching of an <any> association. The DTD accepts lazy="false|true", however at runtime it doesn't make any difference.
Digging deeper, we see that org.hibernate.mapping.Any does not have a lazy property, furthermore, it does not extend Fetchable. This explains why it will not work as expected.
There are two possible resolutions:
1) Implement eager fetching for <any> associations, unless there is some technical difficulty in doing so. Of course lazy fetching won't be possible using joins because of the nature of this type of associations, however it should be simple enough with a second select. This means that the XML config should handle lazy="false|true" but not fetch="join|select|subselect|etc"
2) Fix the DTD in case this can't be done to avoid confusion (less desirable).
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-3008) Cascade delete does not work with unidirectional @OneToMany and @JoinTable
by Daniel Dyer (JIRA)
Cascade delete does not work with unidirectional @OneToMany and @JoinTable
--------------------------------------------------------------------------
Key: HHH-3008
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3008
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Standalone entity manager (JavaSE 5.0).
H2 database.
Reporter: Daniel Dyer
A unidirectional one-to-many relationship defined as follows:
public class Owner
{
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "owner_element",
joinColumns = @JoinColumn(name = "owner_id",
nullable = false,
updatable = false),
inverseJoinColumns = @JoinColumn(name = "element_id",
nullable = false,
updatable = false))
private List<Element> elements;
// ...
}
Attempting to delete an instance of Owner should also delete all associated instances of Element. Instead I get the following error:
SEVERE: Referential integrity constraint violation: FK56BBF9C487E817D: PUBLIC.OWNER_ELEMENT FOREIGN KEY(OWNER_ID) REFERENCES PUBLIC.OWNER(ID) [23003-63]
This is because Hibernate attempts to delete the Owner row without first removing the rows from the join table.
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-4073) discriminator formula creates problem in hibernate envers
by Saravana Kumar (JIRA)
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
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
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-3359) Loader leaks memory when ResultSet wrapping is enabled
by Frans Flippo (JIRA)
Loader leaks memory when ResultSet wrapping is enabled
------------------------------------------------------
Key: HHH-3359
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3359
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1, 3.2.6
Environment: Hibernate 3.2.6 GA, Oracle 10g database, Oracle JDBC drivers 10.2.0.1.0 for JDK14
Reporter: Frans Flippo
Priority: Minor
Attachments: ResultSetWrapper.java
This issue was already reported on the forums (http://forum.hibernate.org/viewtopic.php?t=968578), but I can find no actual JIRA entry. The issue is that when the hibernate.jdbc.wrap_result_sets property is set to true, ResultSets are never removed from the AbstractBatcher's resultSetsToClose set, eventually causing memory to fill up with ResultSet objects and their associated resources (like PreparedStatements).
This issue was witnessed in 3.2.6, but a look at the 3.3 CR1 source code reveals that it's still in there.
What happens:
1) org.hibernate.loader.Loader.doQuery calls org.hibernate.loader.Loader.getResultSet
2) org.hibernate.loader.Loader.getResultSet calls Batcher.getResultSet. The AbstractBatcher implementation creates a ResultSet by executing the query and adds it to the AbstractBatcher's resultSetsToClose Set
3) Loader then calls its wrapResultSetIfEnabled method to wraps the ResultSet in a ResultSetWrapper if the wrap_result_sets option is enabled.
4) In Loader.doQuery's finally block, Batcher.closeQueryStatement is called with the PreparedStatement and the *wrapped* ResultSet as parameters
5) closeQueryStatement does:
if ( resultSetsToClose.remove( rs ) ) {
logCloseResults();
rs.close();
}
6) resultSetsToClose.remove(rs) will always return false if the ResultSet was wrapped, as ResultSetWrapper does not override equals()/hashCode() (and therefore inherits Object's equals() and hashCode()). This means the reference to the original (unwrapped) ResultSet remains (is not removed from the Set) and the ResultSet is not closed either as a result.
Workaround: Set hibernate.jdbc.wrap_result_sets to false
Solution: implement ResultSetWrapper.equals()/hashCode() (see attached ResultSetWrapper.java)
--
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, 9 months