Skip to main content

[jpa-spec users] [jsr338-experts] @Convert precedence

  • From: Steve Ebersole <steve.ebersole@...>
  • To: jsr338-experts@...
  • Subject: [jpa-spec users] [jsr338-experts] @Convert precedence
  • Date: Thu, 22 Aug 2013 09:09:50 -0500
  • List-id: <jsr338-experts.jpa-spec.java.net>

I could not find mention of this in the spec so wanted to start a discussion within the group. The concern is what to do when multiple @Convert definitions can apply to a given attribute. If the spec does cover this, I apologize; if so, could someone point out the section?


2 examples:

1) non-path

@Entity
@Convert( attributeName="firstName", converter=FNameConverter.class )
class Person{
    ...
    @Convert( converter=FirstNameConverter.class )
    String firstName;
}


2) path

@Entity
@Convert( attributeName="homeAddress.city", converter=HomeAddressCityConverter.class )
class Person {
    ...
    @Embedded
    Address homeAddress;
}

@Embeddable
class Address  {
    ...
    @Convert( converter=CityConverter.class )
    String city;
}


In (2) I think it is clearly better to apply HomeAddressCityConverter. But in (1) I think it is less clear cut; there, personally, I'd think FirstNameConverter would be applied. But not sure it makes sense to have different precedence rules.


[jpa-spec users] [jsr338-experts] @Convert precedence

Steve Ebersole 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

gordon yorke 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Steve Ebersole 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Steve Ebersole 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

gordon yorke 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Kevin Sutter 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Steve Ebersole 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

gordon yorke 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Linda DeMichiel 08/22/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Steve Ebersole 08/30/2013

[jpa-spec users] [jsr338-experts] Re: @Convert precedence

Kevin Sutter 08/30/2013
 
 
Close
loading
Please Confirm
Close