[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-141?page=co...
]
tao wen commented on ANN-141:
-----------------------------
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 annotation support for UserCollectionType
---------------------------------------------
Key: ANN-141
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-141
Project: Hibernate Annotations
Issue Type: Patch
Components: binder
Affects Versions: 3.1beta6
Environment: All versions, database agnostic
Reporter: Douglas Sjoquist
Priority: Minor
Attachments: UserCollectionTypeAnnotation.zip
Original Estimate: 30 minutes
Remaining Estimate: 30 minutes
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