openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sia <sia_...@hotmail.com>
Subject Forcing an outer join in many-to-one relations with order by column
Date Tue, 17 Mar 2015 22:55:07 GMT
Hello All:

I was wondering if someone can help me with this issue. I have been reading/searching the
forum with no avail as well all over the web. I have an entity as follows:

@Entity
@Table(name = "REQUEST")
public class Request {

@ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "SLOT_ID", referencedColumnName = "SLOT_ID")
    private Asset slot;

.....
}

Running the following query cause a left outer join with my relation : 

Select r from Request r;

However; if I run

Select r from Request r ORDER BY r.slot.name

this would generate an inner join.

I would like to force an outer join at all times at the entity level. I have looked into writing
a custom strategy by extending RelationFieldStrategy; however, I see only addFetchInnerJoin
in JDBCFetchConfiguration class when I try to override

public void selectEagerJoin(Select sel, OpenJPAStateManager sm,
                            JDBCStore store, JDBCFetchConfiguration
fetch, int eagerMode)

Can someone kindly give me a hint if this is possible or I have to extend a different class
or some how set the fetch mode to OUTER JOIN in my entity.
 		 	   		  
Mime
View raw message