pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPSQLException Can't infer the SQL type to use with Native Query call
2+ messages / 2 participants
[nested] [flat]
* PSQLException Can't infer the SQL type to use with Native Query call
@ 2011-05-02 18:03 Steven Dahlin <pgdb.sldahlin@gmail.com>
2011-05-03 01:33 ` Re: PSQLException Can't infer the SQL type to use with Native Query call Craig Ringer <craig@postnewspapers.com.au>
0 siblings, 1 reply; 2+ messages in thread
From: Steven Dahlin @ 2011-05-02 18:03 UTC (permalink / raw)
To: pgsql-jdbc
In trying to call a postgresql 8.4 stored function I am passing a
class as well as a List (I have to save a master record as well as the
detail records). This is being done with a native query using
EclipseLink 2.1. However, I am getting back a message for the first
item:
PSQLException: Can't infer the SQL type to use for an instance of
com.hwcs.veri.shared.dto.MyClass. Use setObject() with an explicit
Types value to specify the type to use.
I am calling the query setting up the parameter with:
query.setParameter( 1, myClass );
The receiving stored function has the following:
FUNCTION perform_schema.saveInfo( newrec boolean,
myClass <user defined type>,
myDtl <user defined type>[] )
I am unclear how to setup the pass fromm eclipselink to postgresql.
Does anyone have any suggestions or can point to docs which speak to
this specifically?
Thanks
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PSQLException Can't infer the SQL type to use with Native Query call
2011-05-02 18:03 PSQLException Can't infer the SQL type to use with Native Query call Steven Dahlin <pgdb.sldahlin@gmail.com>
@ 2011-05-03 01:33 ` Craig Ringer <craig@postnewspapers.com.au>
0 siblings, 0 replies; 2+ messages in thread
From: Craig Ringer @ 2011-05-03 01:33 UTC (permalink / raw)
To: Steven Dahlin <pgdb.sldahlin@gmail.com>; +Cc: pgsql-jdbc
On 03/05/11 02:03, Steven Dahlin wrote:
> In trying to call a postgresql 8.4 stored function I am passing a
> class as well as a List (I have to save a master record as well as the
> detail records). This is being done with a native query using
> EclipseLink 2.1. However, I am getting back a message for the first
> item:
>
> PSQLException: Can't infer the SQL type to use for an instance of
> com.hwcs.veri.shared.dto.MyClass. Use setObject() with an explicit
> Types value to specify the type to use.
>
> I am calling the query setting up the parameter with:
>
> query.setParameter( 1, myClass );
You'll have to translate 'MyClass' to a SQL type representation (say,
'text') yourself, use a form of query.setParameter() that takes a
javax.sql.Types argument allowing you to specify the SQL type, or write
a mapping for ExclipseLink to support your data type.
The JDBC interface doesn't really understand complex types, record
representations, etc. Because EclipseLink tries to use only the basic,
widely supported features of JDBC you can't easily use PgJDBC extensions
to map between PostgreSQL types and Java types directly.
--
Craig Ringer
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-05-03 01:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-02 18:03 PSQLException Can't infer the SQL type to use with Native Query call Steven Dahlin <pgdb.sldahlin@gmail.com>
2011-05-03 01:33 ` Craig Ringer <craig@postnewspapers.com.au>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox