-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Why shouldn't AttributeConverters be used on identifiers?
PostPosted: Thu Jun 19, 2014 7:28 am 
Newbie

Joined: Thu Jun 19, 2014 4:31 am
Posts: 1
Since JPA 2.1 it is possible to use an AttributeConverter to map a JPA-attribute-domain value to a RDMBS-domain value. The documentation states these converters shouldn't be used for identifier attributes "because that gives non-portable code".

My question is: why that limitation on identifier attributes?

Reasons why it should not be a problem:

(1)
If there is a clear separation of the concerns "manage enities, their relations and state" and "retrieve/store data from/into seom backend" are truly separated, such a limit makes no sense. If the concerns are not truly separated, the consequences should be for all attributes.

(2)
Another concern could be that expressions that use identifiers or operators on identifiers have a different meaning or become invalid when the value gets converted. But the in the case of an identifier I assume that a converter is an invertible operation. It does not change the cardinality of values. Nor does it break an equality or non-equality relationship on both ends of the converter.

(3)
I can imagine that there are (legacy) implementation details that do not make the separation perfect. In my opinion, that should never permeate into the API.

To be clear: I can and I did work around this problem, but I'm not satisfied by the explanation (if any) offered by the documentation. If there is a perfectly solid explanation for the limitation on identifier attributes I would like to learn that explanation.

Thanks in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.