openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Struberg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2179) 'distinct' and 'join' combinations lead lots of unneccessary sub-queries for @Embedded and @Lob fields
Date Sun, 29 Apr 2012 20:21:49 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264596#comment-13264596
] 

Mark Struberg commented on OPENJPA-2179:
----------------------------------------

I have a pretty hard time reproducing this in OpenJPA. 

Now I imported the 1:1 tables from our real project and getting the following Exception:

Caused by: java.sql.SQLException: Ung?ltiger Spaltentyp: getCLOB not implemented for class
oracle.jdbc.driver.T4CVarcharAccessor
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
	at oracle.jdbc.driver.Accessor.unimpl(Accessor.java:358)
	at oracle.jdbc.driver.Accessor.getCLOB(Accessor.java:1328)
	at oracle.jdbc.driver.OracleResultSetImpl.getCLOB(OracleResultSetImpl.java:1311)
	at oracle.jdbc.driver.OracleResultSetImpl.getClob(OracleResultSetImpl.java:1477)
	at org.apache.commons.dbcp.DelegatingResultSet.getClob(DelegatingResultSet.java:553)
	at org.apache.commons.dbcp.DelegatingResultSet.getClob(DelegatingResultSet.java:553)
	at org.apache.openjpa.lib.jdbc.DelegatingResultSet.getClob(DelegatingResultSet.java:592)
	at org.apache.openjpa.jdbc.sql.DBDictionary.getClob(DBDictionary.java:746)
	at org.apache.openjpa.jdbc.sql.OracleDictionary.getClobString(OracleDictionary.java:659)


The funny thing is that I do NOT get this error in prodution! The only difference is that
we are using c3p0 as pool.
                
> 'distinct' and 'join' combinations lead lots of unneccessary sub-queries for @Embedded
and @Lob fields
> ------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2179
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2179
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.3.0
>
>
> I have an Entity (Course) with a simple @Embedded field and a @Lob. I do not use any
LAZY attribution on them!
> If I do a normal em.find, the entity will be loaded as a whole (all the fields, including
the embedded and the lob will be fetched immediately).
> Sidenote: the Lecturer referred in the select is defined as
>     @OneToMany(mappedBy = "course",
>             cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},
>             orphanRemoval = true, fetch = FetchType.EAGER)
>     @OrderColumn(name = "POSITION")
>     private List<Lecturer> lecturers;
> The following selects DO work
> * "select c from Course c join c.lecturers l "
> * "select distinct c from Course c"
> The following selects create tons of subqueries! 1 separate sub-query for each @Embedded
field, and also for each @Lob
> * "select distinct c from Course c join c.lecturers l "
> * "select distinct c from Lecturer l join l.course c"
> * "select c from Lecturer l join l.course c" 
> This happens ONLY if I run this stuff against Oracle. In MySQL it seems to work properly.
> I'll try to create a unit test for it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message