openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hinshaw <chris.hins...@gmail.com>
Subject How to remove DISTINCT clause for @Persistent object getter
Date Wed, 18 Jan 2012 20:53:36 GMT


Sorry this problem is a little complex to explain but I will try to be as
verbose as possible. Any assistance would be very appreciated in solving
this issue. I am thinking that the problem is that the Persistent option on
the "RData value" in ReportExecutionOutput is creating me a OneToOne which
is adding the DISTTINCT clause but I am unsure on how to resolve this.


This is the query that I am running to retch an implementation of a
MappedSuperClass, the implementation of RDataStringVector_value is a
List<String> and the DISTINCT option is only returning
me the unique elements in the list.  


// Debug on query, notice the DISTINCT
SELECT DISTINCT t3.id, t4.element FROM ReportExecution t0 INNER JOIN
ReportExecution_ReportExecutionOutput t1 ON t0.id = t1.REPORTEXECUTION_ID
INNER JOIN ReportExecutionOutput t2 ON t1.OUTPUTS_ID = t2.id INNER JOIN
RDataStringVector t3 ON t2.outputValue = t3.id INNER JOIN
RDataStringVector_value t4 ON t3.id = t4.RDATASTRINGVECTOR_ID WHERE
t0.REPORT_ID = ? ORDER BY t3.id ASC [params=?]


* In this object I am trying to access the RData value which is a
MappedSuperClass that contain their own values such as a List<Double> or
List<String> .

@Entity
public class ReportExecutionOutput extends DatastoreObject {
   
    /**
     * The output definition has more information about what to
     * do with the value associated.
     */
    @OneToOne(cascade = CascadeType.ALL, fetch=FetchType.EAGER)
    private ReportOutputDefinition outputDefinition;
   
    /**
     * Value for the input.
     */
    @Persistent(cascade = { CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.REMOVE})
    private RData<?> outputValue;

........






@MappedSuperclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class RData<T> extends DatastoreObject {

    @Persistent
    private String name;

    public RData() {
    }

    /**
     * Constructor that takes
     * @param name
     */
    public RData(String name) {
        this.name = name;
    }

........................





@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class RDataVector<T> extends RData<List&lt;T>> {

    public RDataVector() {
    }

    public RDataVector(String name) {
        super(name);
    }

    @Override
    public String toString() {
        String debugString = "";
        for (T d : getValue()) {
            debugString += "" + d;
        }
        return debugString;
    }
   
..............................




@Entity
public class RDataStringVector extends RDataVector<String> {

    @PersistentCollection(elementCascade = CascadeType.ALL, fetch =
FetchType.EAGER)
    private List<String> value;

    public RDataStringVector() {
        super();
    }
............... 

--
View this message in context: http://openjpa.208410.n2.nabble.com/How-to-remove-DISTINCT-clause-for-Persistent-object-getter-tp7201602p7201602.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message