[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-636?page=co...
]
tao wen commented on ANN-636:
-----------------------------
I think I have found a solution without changing the hibernate code. Currently, to let the
AnnotationConfiguration be able to handle UserCollectionType, there are to two issues.
First, Ejb3ReflectionManager think the member is not a collection, so you will first get a
"Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or
@CollectionOfElements" exception. This could be work around by change the reflection
manager in AnnotationManager. Second issue is the typeName(which is the class name of your
UserCollectionType class) property of Set mapping is null (of coz it is null, because
there is no place to set it), so hibernate will use default SetType to handle it, which
will cause runtime "setter unknown" exception. This could be workaround by
post-process the configuration produced by AnnotationConfiguration.configure(), set the
typeName for all the set mapping you think need to use your UserCollectionType.
Finally, it is a hack, not a solution.
Add the annotations to map the User Collection Type
---------------------------------------------------
Key: ANN-636
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-636
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Environment: n/a
Reporter: jason
I am searching a way from the Hibernate Annotation to map the user defined collection,
and find out the following :
Can anybody let me know what the status for this? or how i can map the user collection
type by hibernate annotation, thanks
Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but
I didn't know the standards for naming classes.
The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//'
comment lines.
Usage:
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "id")
@CollectionTypeInfo(name = "examples.MyUserCollectionType")
public List<ExampleAttribute> getExampleAttributes() {
--
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