[Hibernate-JIRA] Created: (ANN-569) Map the same class twice in orm.xml
by Christian Bauer (JIRA)
Map the same class twice in orm.xml
-----------------------------------
Key: ANN-569
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-569
Project: Hibernate Annotations
Type: New Feature
Components: binder
Reporter: Christian Bauer
Priority: Minor
Regular annotated class, I'd like to map it again in orm.xml with a different set of persistent attributes (they are annotated transient in the regular class):
<!-- If I don't have the regular class mapped here, I get only a NODE_HISTORY table. I want two tables. -->
<entity class="Node" name="RegularNode" access="FIELD">
<table name="NODE"/>
</entity>
<entity class="Node" name="HistoricalNode" access="FIELD">
<table name="NODE_HISTORY"/>
<attributes>
<id name="historicalNodeId">
<column name="NODE_HISTORY_ID"/>
<generated-value/>
</id>
<basic name="revision" optional="false">
<column name="NODE_REVISION"/>
</basic>
<basic name="id" optional="false">
<column name="NODE_ID"/>
</basic>
</attributes>
</entity>
I currently only have 3.2.0 CR1 (Seam...) here:
[hibernatetool] javax.persistence.PersistenceException: java.lang.IllegalStateException: Duplicate XML entry for org.jboss.seam.wiki.core.node.Node
[hibernatetool] java.lang.IllegalStateException: Duplicate XML entry for org.jboss.seam.wiki.core.node.Node
If the spec forbids duplicate class names in orm.xml (does it?) - how can I override mappings under a different entity alias?
--
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
17 years, 1 month
[Hibernate-JIRA] Created: (HHH-2483) Equals method of Embeddable object not getting called.
by Unnikrishnan.k.v (JIRA)
Equals method of Embeddable object not getting called.
------------------------------------------------------
Key: HHH-2483
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2483
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2, JavaDB
Reporter: Unnikrishnan.k.v
As a work around to issue reported in HHH-2482, I tried using a Embeddable object *PasswordHolder* which implements correct equals method to compare char[]'s.
But even then hibernate is calling equals method of char[] instead of equals method implemented in PasswordHolder.
I am pasting the PasswordHolder source below. To reproduce the issue,
1. create an entity with PasswordHolder as embedded field.
2. Use version number for optimistic locking.
3. Insert a row into db.
4. Now fetch this row through Hibernate entity manager.
5. After the program exits, check the version number of the accessed row.
import java.io.Serializable;
import java.sql.SQLClientInfoException;
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
*
* @author unni
*/
@Embeddable
public class PasswordHolder implements Serializable {
/** Creates a new instance of Password */
public PasswordHolder() {
}
public PasswordHolder(char[] password) {
this.password = password;
}
private char[] password;
@Column(length = 32, nullable = false)
public char[] getPassword() {
return password;
}
public void setPassword(char[] password) {
this.password = password;
}
public boolean equals(Object o) {
if (o instanceof PasswordHolder) {
AppUtil appUtil = AppUtil.getInstance();
return (0 == appUtil.compare(this.password, ((PasswordHolder)o).password));
}
return false;
}
public int hashCode() {
return password.hashCode();
}
}
--
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
17 years, 1 month
[Hibernate-JIRA] Created: (HHH-2482) Equals method missing in CharArrayType
by Unnikrishnan.k.v (JIRA)
Equals method missing in CharArrayType
--------------------------------------
Key: HHH-2482
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2482
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: hibernate-3.2.2.ga, JavaDB
Reporter: Unnikrishnan.k.v
I am working on a Hibernate entity which contains a char[] field to store password.
public class Contact implements java.io.Serializable {
private String userName;
private char[] password;
private Integer version;
}
Now the problem that I am observing is, version is getting incremented even when none of the fields are changed.
Hibernate log showed that *password* field is getting dirty. But, on doing single step debug I found that hibernate is using
EqualsHelper.equals() method to compare two arrays. This results in wrong result. I think, the correct implementation should be
to add an equals method in CharArrayType.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
17 years, 1 month