Dennis,
Does your @Embeddable contains the same set of fields/properties as the Entity?
thanks,
-marina
Dennis Gesker wrote:
> Tom:
>
> Thanks for responding back to my email. I put the ms-jdbc driver
> configuration (connection pool) back in place and increased the log levels.
>
> There is no mapping on the entity to other entities. But the entity does
> have an @EmbeddedId decoration and corresponding @Embeddable class.
>
> Eight columns do appear twice in the SQL statement that is output, all
> of which are part of the Entities associated @Embeddable class.
>
> I commented out the setter method logic but still the duplicate columns
> appear. Finally, I commented out the embedded field and its
> getter/setter and replaced the embedded field with an auto generated id
> field. At this point I was able to persist with no duplication of
> columns. (though I now have an unneeded id column)
>
> The "table" I'm pulling from is really a query and is accessed/setup as
> an Entity with an EmbeddedId. The table into which I'm trying to persist
> entities is almost identical to the first Entity class -- cut and paste
> Entity and Embeddable class, put in new package, put in new persistence
> unit, allow PU to create table in different database.
>
> I didn't anticipate that JPA would add the extra columns to the INSERT
> INTO statement (should I have?). I must be doing something wrong with
> the embedded PK but I'm not sure what... or, is it supposed to add the
> columns from EmbeddedId as extra columns. If so, why didn't these fields
> get added when JPA created the table in the database (assuming the
> database could handle duplicate column names) or error out?
>
> Again, I know I'm missing something obvious but I'm not sure what...
>
> Dennis
>
>
>
> On Tue, Apr 22, 2008 at 1:11 PM, Tom Ware <tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>> wrote:
>
> 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>
> <mailto: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>
> <mailto: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>
> <mailto:dennis_at_gesker.com <mailto:dennis_at_gesker.com>>
>
> Key Id: 0xEFA10A51
> First things first, but not necessarily in that order. -- Unknown
>
>
>
>
> --
> 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