[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] About Oracle User defined types
|
We have direct support for Arrays that has been around for quite a while. (and
JPA mapping support starting in EclipseLink 2.3)
Documentation Link:
http://wiki.eclipse.org/Configuring_an_Object-Relational_Data_Type_Array_Mapping_(ELUG)
JPA Mapping info:
http://www.eclipse.org/eclipselink/api/2.3/index.html
-Tom
On 20/01/2012 3:28 PM, Luis Dominguez wrote:
Like this:
Map types = conn.getTypeMap();
types.put("C_PriceType", PriceType.class);
conn.setTypeMap(types);
java.sql.Array priceList = rs.getArray("PRICE_LIST");
2012/1/20 Tom Ware <tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>>
How would you access the fields of the object if you were using JDBC?
-Tom
On 20/01/2012 9:58 AM, Luis Dominguez wrote:
The Stored Procedures is in an oracle database. The procedure returns a
sys_refcursor, where the cursor has the following fields:
ID: it's a number field type.
Prices List: It's a list of Price type. An oracle user defined type with te
following structure:
* Id of price item: Number field
* priceAmount: amount. It's a NUMBER(12, 5) field.
If i used DataReadQuery with a StoredProcedureCall, the result list when the
query is executed has a list of DatabaseRecord, where the records has an
object
array for the prices list.
I need to obtain the prices values, but using DataReadQuery the prices
list is
returned as an Object array, with Object type elements, and no
possibilities to
cast to the desired object.
Help.
2012/1/20 Tom Ware <tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>
<mailto:tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>>>
Can you explain a little more about what this custom type is? We
provide a number of ways you can deal with special types and
your choice
will depend on how it is derived.
At the simplest level, you can specify a Converter on the object
that
maps to the special type. That will allow you do do some
operations.
http://wiki.eclipse.org/Using_____EclipseLink_JPA_Extensions_%____28ELUG%29#Using_EclipseLink_____JPA_Converters
<http://wiki.eclipse.org/Using___EclipseLink_JPA_Extensions_%__28ELUG%29#Using_EclipseLink___JPA_Converters>
<http://wiki.eclipse.org/__Using_EclipseLink_JPA___Extensions_%28ELUG%29#Using___EclipseLink_JPA_Converters
<http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Using_EclipseLink_JPA_Converters>>
Alternately, we have an event mechanism that will allow you to
access
the data at various points in the query.
http://www.eclipse.org/____eclipselink/api/2.3/index.html
<http://www.eclipse.org/__eclipselink/api/2.3/index.html>
<http://www.eclipse.org/__eclipselink/api/2.3/index.html
<http://www.eclipse.org/eclipselink/api/2.3/index.html>__>
If the data structure is, in fact, a Struct, you may be able to
make use
of our StructConverter to operate on it as it enters and leaves the
database.
http://wiki.eclipse.org/Using_____EclipseLink_JPA_Extensions_(____ELUG)#How_to_Use_the_.____40StructConverter_Annotation
<http://wiki.eclipse.org/Using___EclipseLink_JPA_Extensions_(__ELUG)#How_to_Use_the_.__40StructConverter_Annotation>
<http://wiki.eclipse.org/__Using_EclipseLink_JPA___Extensions_(ELUG)#How_to_Use___the_.40StructConverter___Annotation
<http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#How_to_Use_the_.40StructConverter_Annotation>>
-Tom
On 19/01/2012 4:08 PM, Luis Dominguez wrote:
Hi everybody.
I'm using eclipselink with JPA. Actually, i'm using
eclipselink for
a stored
procedure call. The results of the stored procedure have a
"column",
with a
custom type object value. The sentence
List<DatabaseRecord> queryResultList = (List)
((JpaEntityManager)
main.em.getDelegate()).____getActiveSession().____executeQuery(query,
queryArgs);
recovers a list of DatabaseRecord, with a field as
[Ljava.lang.Object;@10010ec
object. When i'm trying to iterate this array, only have a
[Ljava.lang.Object;,
with no possibilities of see the data.
How i can do that?
___________________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
<mailto:eclipselink-users@__eclipse.org
<mailto:eclipselink-users@xxxxxxxxxxx>>
https://dev.eclipse.org/____mailman/listinfo/eclipselink-____users
<https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users>
<https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
<https://dev.eclipse.org/mailman/listinfo/eclipselink-users>>
___________________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
<mailto:eclipselink-users@__eclipse.org
<mailto:eclipselink-users@xxxxxxxxxxx>>
https://dev.eclipse.org/____mailman/listinfo/eclipselink-____users
<https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users>
<https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
<https://dev.eclipse.org/mailman/listinfo/eclipselink-users>>
_________________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
<https://dev.eclipse.org/mailman/listinfo/eclipselink-users>
_________________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
<https://dev.eclipse.org/mailman/listinfo/eclipselink-users>
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users