The first thing to do is to take a look at the SQL that is being generated. To
do that, set your logging to a level that allows you to see SQL and take a look
at the logs. I suggest the FINEST level of logging when debugging. To use that
logging level, just add this property to your persistence unit:
<property name="toplink.logging.level" value="FINEST"/>
Looking at the SQL may give you an idea of what is happening.
If that doesn't help, please post the SQL, the query you are running and how the
entities involved in the query are mapped.
-Tom
Dennis Gesker wrote:
> I posted this question to the users_at_glassfish.dev.java.net
> <mailto:users_at_glassfish.dev.java.net> mailing list but didn't get a
> response. In the mean time I swapped out the microsoft jdbc driver for
> the jTDS jdbc driver. Still the problem remains.
>
> Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build
> b04-fcs (04/11/2008))):
> oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: java.sql.SQLException: Column name 'EmployeeID'
> appears more than once in the result column list.
> Error Code: 264
>
>
> Any chance of a pointer in the right direction?
>
>
> --drg
>
>
> On Fri, Apr 18, 2008 at 5:00 PM, Dennis Gesker <dennis_at_gesker.com
> <mailto:dennis_at_gesker.com>> wrote:
>
> I am trying to use an em to insert data into a database table but
> seem to have hit a snag.
>
> The table was created in the database by JPA from the Entity Class
> by setting the toplink.ddl-generation property to 'create-tables' in
> the persistence unit.
>
> The field that is being reported as "appearing more than once" only
> appears once in the Entity class and does have both a getter and
> setter method -- no compile error. A query against the syscolums
> table in the database server indicates that the field only appears
> once. A 'select *' against the table at the database server also
> only returns this column once.The user/passwd combination used in
> the connection pool has full privilages on the database.
>
> There are quite a few fields in the table but all are of basic
> types; string, float, etc. - no blobs; The table is meant to be
> updated each evening from a the results of a query on a different
> database server so presently I'm pulling the data (using JPA) into a
> resultlist and attempting to use an iterator/while loop to persist
> the records. The loop doesn't appear to be the issue.
>
> The specific error I'm getting is:
>
> Caused by: javax.persistence.PersistenceException: Exception
> [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b03-fcs
> (04/05/2008))): oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException:
> Column name 'EmployeeID' appears more than once in the result column
> list.
>
> The 'Call" portion of the error message includes the column as part
> of the INSERT INTO twice. Other columns are also listed twice in
> this statement.
>
>
> Could someone offer a pointer on where I might look next to resolve
> this item? Any tips or hints would be most appreciated.
>
> Dennis
> Using NB6.1, Glassfish V2Ur2
>
>
>
>
> --
> Dennis R. Gesker
> email: dennis_at_gesker.com <mailto:dennis_at_gesker.com>
> Key Id: 0xEFA10A51
> First things first, but not necessarily in that order. -- Unknown