[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5483) Better use of annotations for custom types

Xavier Dury (JIRA) noreply at atlassian.com
Tue Aug 17 02:36:41 EDT 2010


Better use of annotations for custom types
------------------------------------------

                 Key: HHH-5483
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5483
             Project: Hibernate Core
          Issue Type: Improvement
          Components: annotations
            Reporter: Xavier Dury
            Priority: Minor


Better use of annotations for custom types.

Allow org.hibernate.annotations.Type to be used on annotations like this:

public interface AnnotationConfiguredType<A extends Annotation> {

	void configure(A configuration);
}

@Retention(RUNTIME)
@Target({FIELD, METHOD})
@Type(type = "...CustomDateType")
public @interface CustomDate {

	String pattern() default "yyyy-MM-dd";

	boolean lenient() default true;

	...
}

public class CustomDateType implements UserType, AnnotatedConfiguredType<CustomDate> {

	public void configure(CustomDate configuration) {
		...
	}

	...
}

@Entity
public class MyEntity {

	@CustomDate(pattern = "dd/MM/yyyy")
	private Date date;

	...
}

-- 
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