[hibernate-issues] [Hibernate-JIRA] Updated: (ANN-181) Do not fail on unbound attributes marked as @Type

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Sep 5 12:46:25 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-181?page=all ]

Emmanuel Bernard updated ANN-181:
---------------------------------

    Summary: Do not fail on unbound attributes marked as @Type  (was: PropertyInferredData fails on generic entities)

> Do not fail on unbound attributes marked as @Type
> -------------------------------------------------
>
>          Key: ANN-181
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-181
>      Project: Hibernate Annotations
>         Type: Bug

>   Components: binder
>     Versions: 3.1beta7
>     Reporter: Ryan Dewell
>     Assignee: Paolo "Nusco" Perrotta
>      Fix For: 3.2.0.cr2

>
>
> Exception is thrown by PropertyInferredData at extractType when handling a generically typed entity.  This problem did not exist in previous versions of PropertyInferredData where "method.getReturnType()" was used to extract the type instead.  
> Workaround patch (falls back to original procedure):
> --------------------------------
> try {
>   returnedClass = extractType(type);
> } catch (Exception e){
>   returnedClass = method.getReturnType();
> }
> Example generic entity:
> --------------------------------
> package com.brightmarket.core.workflow;
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.Table;
> import org.hibernate.annotations.Type;
> import org.hibernate.validator.NotNull;
> import com.brightmarket.core.Model;
> @Entity(name="LifecycleHistory")
> @Table(name="workflow_lifecycle_history")
> public class LifecycleHistory<STATE extends Enum, REASON extends Enum> extends Model{
> 	private static final long serialVersionUID = -8445979354786791933L;
> 	private STATE previousLifecycle;
> 	private STATE newLifecycle;
> 	private REASON newLifecycleReason;
> 	
> 	@Column(name="new_lifecycle")
> 	@NotNull
> 	@Type(type="StringEnum")
> 	public STATE getNewLifecycle() {
> 		return newLifecycle;
> 	}
> 	public void setNewLifecycle(STATE lifecycle) {
> 		this.newLifecycle = lifecycle;
> 	}
> 	
> 	@Column(name="new_lifecycle_reason")
> 	@Type(type="StringEnum")
> 	public REASON getNewLifecycleReason() {
> 		return newLifecycleReason;
> 	}
> 	public void setNewLifecycleReason(REASON lifecycle) {
> 		this.newLifecycleReason = lifecycle;
> 	}
> 	
> 	// NOTE: this isn't strictly needed because it should be accessible via the date stamped lifecycle history occuring prior to this entry.
> 	@Column(name="previous_lifecycle")
> 	@Type(type="StringEnum")
> 	public STATE getPreviousLifecycle() {
> 		return previousLifecycle;
> 	}
> 	public void setPreviousLifecycle(STATE previousLifecycle) {
> 		this.previousLifecycle = previousLifecycle;
> 	}
> 	
> }

-- 
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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list