[Hibernate-JIRA] Created: (HHH-6725) Bidirectional @OneToOne(optional=true) with a foreign ID generator should force optional=false
by Gail Badner (JIRA)
Bidirectional @OneToOne(optional=true) with a foreign ID generator should force optional=false
----------------------------------------------------------------------------------------------
Key: HHH-6725
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6725
Project: Hibernate Core
Issue Type: Improvement
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 4.0.0.next
When a foreign ID generator is used with @OneToOne(optional=true), Hibernate should:
- force optional=false
- log a warning
The default for @OneToOne is optional=true
This should be done when a foreign ID generator is used
- with @OneToOne @PrimaryKeyJoinColumn
- with @OneToOne(mappedBy="...")
Currently, Hibernate allows the one-to-one association to be optional, but if the association is set to null, IdentifierGenerationException is thrown.
I don't think it's possible to check for a ForeignGenerator until the SessionFactory or persister is being built with a Configuration object.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (METAGEN-76) SingularAttribute generated for hashCode method in @Embeddable
by Hrotkó Gábor (JIRA)
SingularAttribute generated for hashCode method in @Embeddable
--------------------------------------------------------------
Key: METAGEN-76
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-76
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: processor
Affects Versions: 1.1.1.Final
Environment: hibernate-jpamodelgen 1.1.1.Final, postgresql 8
Reporter: Hrotkó Gábor
Assignee: Hardy Ferentschik
I got a class composite id class for a table with @Embeddable.
It has two properties, and the equals and the hashCode methods.
When hibernate-jpamodelgen 1.1.1.Final generates the metaclasses, I got a SingularAttribute with the name "hashCode" generated. But hashCode is not a property in the entity.
entity:
/** by hbm2java */
@Embeddable
public class MyTableId implements java.io.Serializable {
private String id;
private Integer memberId;
public MyTableId() {
}
public MyTableId(String id, Integer memberId) {
this.id = id;
this.memberId = memberId;
}
@Column(name="id")
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@Column(name="member_id")
public Integer getMemberId() {
return this.memberId;
}
public void setMemberId(Integer memberId) {
this.memberId = memberId;
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof MyTableId) ) return false;
MyTableId castOther = ( MyTableId ) other;
return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) )
&& ( (this.getMemberId()==castOther.getMemberId()) || ( this.getMemberId()!=null && castOther.getMemberId()!=null && this.getMemberId().equals(castOther.get
MemberId()) ) );
}
public int hashCode() {
int result = 17;
result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() );
result = 37 * result + ( getMemberId() == null ? 0 : this.getMemberId().hashCode() );
return result;
}
}
metaclass:
@StaticMetamodel(MyTableId.class)
public abstract class MyTableId_ {
public static volatile SingularAttribute<MyTableId, String> id;
public static volatile SingularAttribute<MyTableId, Integer> hashCode;
public static volatile SingularAttribute<MyTableId, Integer> memberId;
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-4550) query cache: Attention with configuring Update Timestamps Cache region: expired entries cause wrong result sets!
by Guenther Demetz (JIRA)
query cache: Attention with configuring Update Timestamps Cache region: expired entries cause wrong result sets!
----------------------------------------------------------------------------------------------------------------
Key: HHH-4550
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4550
Project: Hibernate Core
Issue Type: Improvement
Components: caching (L2)
Affects Versions: 3.3.2
Environment: 3.3.2 GA
Reporter: Guenther Demetz
Priority: Trivial
Attachments: TestCaseQuryCache.jar
When using hibernate's query cache (hibernate.cache.use_query_cache),
then it's of fundamental importance to configure the Update Timestamps cache region in
a way that his entries survive longer than the cached result sets in the Query cache region.
Otherwise queries could return wrong (obsolete) result sets (See attached testcase).
This is because the current UpdateTimestampsCache#isUpToDate implementation considers a result-set also as up-to-date,
if there are no update-timestamps cached for the interested spaces (tables) at all.
It if therefore important to notice that:
1- The Update-Timestamps-Cache-Region elements max-size should be configured higher than the number of tables you have
on the db-schema, in manner that he can remember/hold the last update-timestamp for each table.
2- If you use any other eviction policy in the Update-Timestamps-Cache-Region, then you must assure
that cached result sets in the Query-cache-region are evicted before relevant update-timestamps are going to be evicted.
This fact should be clearly documented somewhere.
Thanks
G.D.
--
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
[Hibernate-JIRA] Created: (HHH-3892) Improve support for mapping SQL LONGVARCHAR and CLOB to Java String, SQL LONGVARBINARY and BLOB to Java byte[]
by Gail Badner (JIRA)
Improve support for mapping SQL LONGVARCHAR and CLOB to Java String, SQL LONGVARBINARY and BLOB to Java byte[]
---------------------------------------------------------------------------------------------------------------
Key: HHH-3892
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3892
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 3.2.x, 3.3.x, 3.5
Property types will be provided to enable an application to process data for a java.sql.Types.LONGVARCHAR or java.sql.Types.CLOB column as a Java String. Hibernate will internally process the data as a streams. On a read, stream data will immediately be materialized into a Java string.
text - property type to map java.sql.Types.LONGVARCHAR column data as a Java String (via org.hibernate.type.TextType);
(NOTE: currently, org.hibernate.type.TextType incorrectly maps "text" to java.sql.Types.CLOB; this will be fixed by this issue and updated in database dialects)
materialized_clob - property type to map java.sql.Types.CLOB column data as a Java String (via org.hibernate.type.MaterializedClobType);
In addition, new property types will be provided to enable an application to process data for a java.sql.Types.LONGVARBINARY or java.sql.Types.BLOB column as Java byte[]. Hibernate will internally process the data as a streams. On a read, stream data will immediately be materialized into a Java byte[].
image - property type to map java.sql.Types.LONGVARBINARY column data as byte[] (via org.hibernate.type.ImageType);
materialized_blob - property type to map java.sql.Types.BLOB column data as byte[] (via org.hibernate.type.MaterializedBlobType);
--
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
[Hibernate-JIRA] Created: (HHH-4555) Support use of Envers with Auto-commit mode.
by Kevin Schmidt (JIRA)
Support use of Envers with Auto-commit mode.
--------------------------------------------
Key: HHH-4555
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4555
Project: Hibernate Core
Issue Type: New Feature
Components: envers
Affects Versions: 3.5.0-Beta-2
Environment: Hibernate 3.5.0-Beta-2
Reporter: Kevin Schmidt
Currently Envers is designed so that it synchronizes with the currently running transaction in order to know when to commit the inserts into the Audit Tables. This is an effective strategy for ensuring that the audit information is only saved to the database if the Transactional Unit of Work which caused the audit data to be created is committed.
This design creates a limitation on Envers such that it cannot persist audit information unless there is an active transaction. This effectively disables auditing for anyone modifying data using Hibernate outside of a Hibernate Transaction. Specifically, if you are using Autocommit = True and manually flushing the Hibernate Session then you cannot have any of your data audited using Envers.
I am not that well versed with the design of Envers but was hoping this situation could be detected and avoided. Maybe the audit information could be synchronized on the flush event rather than when a transaction is committed to the database.
--
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
[Hibernate-JIRA] Created: (METAGEN-70) BasicAttributeVistor doesn't recognize subclasses of java.io.Serializeable as Attributes.
by kk (JIRA)
BasicAttributeVistor doesn't recognize subclasses of java.io.Serializeable as Attributes.
-----------------------------------------------------------------------------------------
Key: METAGEN-70
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-70
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: processor
Affects Versions: 1.1.1.Final
Reporter: kk
Assignee: Hardy Ferentschik
Situation:
Interface 'UnitPersistentValueIF' extends 'PersistentValueIF'.
Interface 'PersistentValueIF' extends 'java.io.Serializable'.
Result:
The annotationprocessor creates attributes for element 'PersistentValueIF'
The annotationprocessor doesn't create attributes for element 'UnitPersistentValueIF'
Expected result:
The annotationprocessor creates for both 'PersistentValueIF' and 'UnitPersistentValueIF' the attributes.
I have debugged the annotationprocessor and this could be the solution:
In BasicAttributeVisitor.java in method visitDeclared(DeclaredType declaredType, Element element)
there is the following code:
if ( "java.io.Serializable".equals( interfaceElement.getQualifiedName().toString() ) ) {
This code should also take into account its superclasses (or interfaces).
Can this be done with 'java.lang.model' ?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (METAGEN-66) XML Based Mapping of Embeddets in Mapped-Superclass is ignored
by Ralph Engelmann (JIRA)
XML Based Mapping of Embeddets in Mapped-Superclass is ignored
--------------------------------------------------------------
Key: METAGEN-66
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-66
Project: Hibernate Metamodel Generator
Issue Type: Bug
Affects Versions: 1.1.1.Final
Environment: Meta model generator for Hibernate (Version 1.1.1-Final), Hiberante 3.6.1.Final, Spring 3.0
Reporter: Ralph Engelmann
Assignee: Hardy Ferentschik
I use a Mapped Superclass, which refer to an (generic) Embeddded.
Because this class is located in an different jar I needto map this class explicit in XML.
But the Hibernate Model Generator does not create an field in the Meta Model of the Mapped Superclass that represent the Embedded.
See the code for illustration.
{code:title=Mapped Superclass(BusinessEntity<T>)}
public abstract class BusinessEntity<T extends Serializable>
implements Serializable {
private Long id;
private BusinessId<T> businessId;
...
}
{code}
{code:title=Generic Embedded (BusinessId<T>)}
public class BusinessId<T> implements Serializable {
private long businessId;
...
}
{code}
{code:title=orm.xml}
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">
<mapped-superclass class="BusinessEntity"
access="FIELD">
<attributes>
<id name="id">
<column nullable="false"/>
<generated-value strategy="AUTO"/>
</id>
<embedded name="businessId"/>
</attributes>
</mapped-superclass>
<embeddable class="BusinessId"
access="FIELD">
<attributes>
<basic name="businessId">
<column nullable="false" unique="true"/>
</basic>
</attributes>
</embeddable>
</entity-mappings>
{code}
{code:title=Generated Meta Model (BusinessEntity_)}
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@StaticMetamodel(BusinessEntity.class)
public abstract class BusinessEntity_ {
public static volatile SingularAttribute<BusinessEntity, Long> id;
}
{code}
{code:title=Generated Meta Model (BusinessId_)}
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@StaticMetamodel(BusinessId.class)
public abstract class BusinessId_ {
public static volatile SingularAttribute<BusinessId, Long> businessId;
}
{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