[Hibernate-JIRA] Updated: (HHH-1109) composite-key does not support null-values
by Thijs Thiessens (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109?page=c... ]
Thijs Thiessens updated HHH-1109:
---------------------------------
Attachment: NullableStringType.java
A Nullable User Type that implements the strategy to select the null fields and replacing them by a default value.
> composite-key does not support null-values
> ------------------------------------------
>
> Key: HHH-1109
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: [org.hibernate.type.EmbeddedComponentType.hydrate(...)#425]
> Reporter: Holger Bartnick
> Attachments: componentType-fix-nullkey-compositekey.patch, NullableStringType.java
>
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> At present all legacy data with null-values in its composite-key could not be read properly by hibernate.
> While hibernate processes the resultset it returns null for that record and steps over to the next one.
> Think of a db-view, which combines two (or more) tables by outer-join.
> (that seems only necessary for crude legacy data indeed... but it´s not that unusual as you think)
> The workaround is to use a db-generated identifier for each view-record (ex. combining the nullable-id fields).
> It would be fine, if hibernate is not reliant on that. ;-)
> To allow having composite-keys with partly null-Values, you could think of moving the "unsaved-value"-attribute
> of the "composite-key"-tag to "key-property|key-many-to-one"-Tags...?!
> ---
> Mmmh... saw you´ve done something with "columnNullness" in ver 3.1beta2. Perhaps it is fixed in there...
> also seen on HB-613
--
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
15 years, 5 months
[Hibernate-JIRA] Created: (ANN-593) Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
by John Newman (JIRA)
Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
---------------------------------------------------------------------------------
Key: ANN-593
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-593
Project: Hibernate Annotations
Issue Type: Improvement
Components: binder
Affects Versions: 3.2.1
Environment: INFO Version:15 - Hibernate Annotations 3.2.1.GA
09:15:01,755 INFO Environment:500 - Hibernate 3.2.1
INFO SettingsFactory:81 - RDBMS: Microsoft SQL Server, version: 08.00.0760
09:15:06,114 INFO SettingsFactory:82 - JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
09:15:06,255 INFO Dialect:151 - Using dialect: org.hibernate.dialect.SQLServerDialect
Reporter: John Newman
If I use a @MappedSuperclass (which is a very useful annotation btw) I have to manually copy any queries I want with taht class up to all subclasses. The binder should check any mapped superclasses and pull those named queries up. i.e.
/**
* Base User class that different projects user classes derive from.
* Hibernate annotations doesn't pick up that query, so you have to copy it up to your subclass
*/
@MappedSuperclass
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // this is useless down here, i just put it here for reference
})
public class BaseUser<PK extends Serializable> extends IdEntity<PK> {
private static final long serialVersionUID = -4443522925041212381L;
protected String loginName;
@Column(unique=true)
public String getLoginName() {
return this.loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
}
/**
* Custom user class for a certain application
*/
@Entity
@Table(name="tbl_user")
@GenericGenerator(name=IdGen.NAME, strategy=IdGen.AUTO)
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // had to copy this up from the base class
})
public class User extends BaseUser<Short> {
private static final long serialVersionUID = -6199544722824321999L;
private String firstName;
...
}
so in short it would be nice if the scanner would check for that and bind any named queries up to the subclass
--
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
15 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1109) composite-key does not support null-values
by Thijs Thiessens (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109?page=c... ]
Thijs Thiessens commented on HHH-1109:
--------------------------------------
You are right. Therefore, in my opinion null values in composite keys should be configurable in the case you want to support legacy schemes.
> composite-key does not support null-values
> ------------------------------------------
>
> Key: HHH-1109
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: [org.hibernate.type.EmbeddedComponentType.hydrate(...)#425]
> Reporter: Holger Bartnick
> Attachments: componentType-fix-nullkey-compositekey.patch
>
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> At present all legacy data with null-values in its composite-key could not be read properly by hibernate.
> While hibernate processes the resultset it returns null for that record and steps over to the next one.
> Think of a db-view, which combines two (or more) tables by outer-join.
> (that seems only necessary for crude legacy data indeed... but it´s not that unusual as you think)
> The workaround is to use a db-generated identifier for each view-record (ex. combining the nullable-id fields).
> It would be fine, if hibernate is not reliant on that. ;-)
> To allow having composite-keys with partly null-Values, you could think of moving the "unsaved-value"-attribute
> of the "composite-key"-tag to "key-property|key-many-to-one"-Tags...?!
> ---
> Mmmh... saw you´ve done something with "columnNullness" in ver 3.1beta2. Perhaps it is fixed in there...
> also seen on HB-613
--
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
15 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1109) composite-key does not support null-values
by Paul Benedict (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109?page=c... ]
Paul Benedict commented on HHH-1109:
------------------------------------
The definition of a key is for it to be identifiable. Since NULL means unknown, it is not identifiable. Keys, by their definition, shouldn't be nullable.
> composite-key does not support null-values
> ------------------------------------------
>
> Key: HHH-1109
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: [org.hibernate.type.EmbeddedComponentType.hydrate(...)#425]
> Reporter: Holger Bartnick
> Attachments: componentType-fix-nullkey-compositekey.patch
>
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> At present all legacy data with null-values in its composite-key could not be read properly by hibernate.
> While hibernate processes the resultset it returns null for that record and steps over to the next one.
> Think of a db-view, which combines two (or more) tables by outer-join.
> (that seems only necessary for crude legacy data indeed... but it´s not that unusual as you think)
> The workaround is to use a db-generated identifier for each view-record (ex. combining the nullable-id fields).
> It would be fine, if hibernate is not reliant on that. ;-)
> To allow having composite-keys with partly null-Values, you could think of moving the "unsaved-value"-attribute
> of the "composite-key"-tag to "key-property|key-many-to-one"-Tags...?!
> ---
> Mmmh... saw you´ve done something with "columnNullness" in ver 3.1beta2. Perhaps it is fixed in there...
> also seen on HB-613
--
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
15 years, 5 months