Skip to main content

[jpa-spec issues] [JIRA] Created: (JPA_SPEC-78) TupleTransformer

  • From: "c.beikov (JIRA)" < >
  • To:
  • Subject: [jpa-spec issues] [JIRA] Created: (JPA_SPEC-78) TupleTransformer
  • Date: Tue, 15 Apr 2014 16:57:49 +0000 (UTC)
  • Auto-submitted: auto-generated

TupleTransformer
----------------

                 Key: JPA_SPEC-78
                 URL: https://java.net/jira/browse/JPA_SPEC-78
             Project: jpa-spec
          Issue Type: New Feature
            Reporter: c.beikov


The constructor syntax in JPQL is limited by the fact, that the class must be 
visible to the classloader of the persistence provider. Also one might want 
to apply a custom transformation strategy based on metadata that does not use 
constructors but factories, builders or setters. To overcome these 
limitations I propose the addition of a TupleTransformer interface which can 
be implemented by a user to provide custom strategies.

{code:title=TupleTransformer.java|borderStyle=solid}
public interface TupleTransformer<X> {
  List<X> transform(List<Tuple> tuples);
  X transform(Tuple tuple);
}
{code}

and an addition to Query and TypedQuery:

{code:title=Query.java|borderStyle=solid}
public interface Query {
  // other methods
  Query setTupleTransformer(TupleTransformer<?> tupleTransformer);
}
{code}

{code:title=TypedQuery.java|borderStyle=solid}
public interface TypedQuery<X> extends Query {
  // other methods
  <Y> TypedQuery<Y> setTupleTransformer(TupleTransformer<Y> tupleTransformer);
}
{code}

For reference see the ResultTransformer of Hibernate: 
http://docs.jboss.org/hibernate/orm/4.3/javadocs/org/hibernate/transform/ResultTransformer.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[jpa-spec issues] [JIRA] Created: (JPA_SPEC-78) TupleTransformer

c.beikov (JIRA) 04/15/2014
 
 
Close
loading
Please Confirm
Close