[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6430) MappedAttribute should make use of HibernateTypeDescriptor

Hardy Ferentschik (JIRA) noreply at atlassian.com
Tue Jul 12 10:58:14 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42943#comment-42943 ] 

Hardy Ferentschik commented on HHH-6430:
----------------------------------------

At the moment only the java type is preserved, but we need to distinguish between java type and explicitly specified types (eg via _ at Type_).
{noformat}
hardy_: sebersole: one question regarding attributes. which "type" do you expect in an attribute binding? Atm I am using the java type, but I am wondering whether I should already try to resolve it to a HibernateType. Not sure exactly what is expected here and where the conversion should occur
[4:31pm] sebersole: hardy_: in the attribute itself?  or the binding?
[4:32pm] sebersole: oh you said binding
[4:33pm] sebersole: getting the hibernate type is not always feasible
[4:33pm] sebersole: reveng case
[4:33pm] sebersole: think ManyToOne
[4:34pm] hardy_: in particular I am talking about AbstractAttributeBinding
[4:34pm] sebersole: have you seen org.hibernate.metamodel.binding.HibernateTypeDescriptor?
[4:34pm] sebersole: we need *something* like that
[4:35pm] sebersole: i am open to suggestions
[4:35pm] sebersole: you've played in the details there
[4:36pm] sebersole: i think this stuff is stil largely the same from my orig proto
[4:36pm] hardy_: it is
[4:36pm] sebersole: obviously that had not been "evolved"
[4:36pm] sebersole: what do you think?
[4:36pm] hardy_: so right now AbstractAttributeBinding has a HibernateTypeDescriptor
[4:36pm] sebersole: like i said, the only rub is that hibernate Type will not work
[4:37pm] sebersole: unfortunately
[4:37pm] hardy_: and w/ the old state code we called - hibernateTypeDescriptor.setTypeName( state.getTypeName() );
[4:37pm] sebersole: thats an explicit type
[4:37pm] hardy_: hence my question - atm from the annotation side 'state.getTypeName()' will be the fqcn of the attribute
[4:38pm] sebersole: i just added some code to do the guessing
[4:38pm] hardy_: that i've seen
[4:38pm] sebersole: ok
[4:38pm] sebersole: well not the stuff gail dd
[4:38pm] sebersole: org.hibernate.metamodel.source.hbm.BindingCreator#resolveTypeInformation
[4:40pm] sebersole: the absolute ideal case would be to be able to resolve to the o.h.type.Type here
[4:40pm] sebersole: but thats not possible unfortunately
[4:42pm] sebersole: hardy_: we probably need some extra info there
[4:42pm] sebersole: thats descriptor type name should be reserved for explicitly referenced type
[4:43pm] sebersole: i assume annotations has @Type or somesuch
[4:43pm] hardy_: yes there is @Type
[4:43pm] sebersole: <property ... type="..."/> is the hbm equiv
[4:43pm] hardy_: so we need some additional information whether the type is explicit or not
[4:44pm] sebersole: well i think :
[4:44pm] sebersole: 1) explicit type name
[4:44pm] sebersole: 2) java type name
[4:44pm] sebersole: i guess thats it
[4:44pm] sebersole: well params
[4:45pm] sebersole: just saying its important t distinguish (1) and (2)
[4:45pm] hardy_: and why can we not use HibernateTypeDescriptor ?
[4:45pm] sebersole: we can
[4:46pm] hardy_: ahh, must have misunderstood something, thought we cannot
[4:46pm] hardy_: so really when I process the annotations I should not just keep the say java type
[4:46pm] hardy_: but I should create a HibernateTypeDescriptor
[4:47pm] sebersole: the attribute creates it
[4:47pm] sebersole: iirc
[4:47pm] sebersole: you just need to populate it
[4:47pm] hardy_: sure, but to populate it I need to have the information available
[4:47pm] sebersole: is this making sense
[4:47pm] hardy_: it does
[4:47pm] sebersole: ok
[4:48pm] sebersole: you do
[4:48pm] sebersole: @Type - (1) explicit type name
[4:48pm] sebersole: Memeber.getType() - (2) java type name
[4:48pm] hardy_: sure
[4:48pm] sebersole: if no @Type, then (1) is nul
[4:49pm] sebersole: and the stuff that uses this info knows how to interpret that
[4:49pm] hardy_: but in the annotation code I create a so called SimpleAttribute instance which collects all sorts of information about the attribute
[4:49pm] sebersole: the binding you mean?
[4:50pm] sebersole: oh
[4:50pm] sebersole: yeah i saw that i believe
[4:50pm] hardy_: and then when I create the AttributeBinding for the metamodel I use the SimpleAttribute to set everything which needs setting
[4:50pm] sebersole: sure
[4:51pm] hardy_: so yes, the information I need is in the annotations, but I need to make sure I have it SimpleAttribute
[4:51pm] sebersole: sure
[4:51pm] sebersole: another thought
[4:51pm] hardy_: I might even just add a HibernateTypeDescriptor to SimpleAttribute
[4:51pm] sebersole: we might also want to make toOne avail as a flag
[4:52pm] sebersole: so we know its "nature"
[4:52pm] hardy_: but that's a tangent now to the type stuff, right?
[4:52pm] sebersole: no
[4:52pm] hardy_: toOne
[4:52pm] sebersole: talking about HibernateTypeDescriptor
[4:52pm] hardy_: i get it
[4:52pm] sebersole: HibernateTypeDescriptor.toOne
{noformat}

> MappedAttribute should make use of HibernateTypeDescriptor
> ----------------------------------------------------------
>
>                 Key: HHH-6430
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6430
>             Project: Hibernate Core
>          Issue Type: Sub-task
>          Components: metamodel
>            Reporter: Hardy Ferentschik
>            Assignee: Hardy Ferentschik
>             Fix For: 4.0.0.next
>
>


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list