Nested Custom Oracle Objects as interpreted by JDBC
Hello,
I have a number of nested custom oracle objects that all extend ORAData and ORAFactory. Should I specify one object, it has no problem writing it to DB using OracleCallableStatement. But I need to write this custom oracle object with another (few) subobjects below, so I created different classes which all extend ORAData (.toDatum) of their own, and map to corresponding oracel objects, but now that I try to do SetObject -- I get
java.sql.SQLException: Fail to convert to internal representation: prog.objMyObj@131303f
so my question is: Can JDBC handle "nested" custom oracle objects? Or is it simple types only as part of one struct ?
Doing the following should provide a correct tree. Try it with a simple example first.
1. Create a type that you want in the database.
2.Extract it using jdbc.
3. Write it back without modification. If this fails then I would guess that you simply can't do it with the driver.
4. if the write works then traverse it and print out the name of each object in it.
If you get to the last step then it will allow you to determine the correct types (if you traverse it correctly.) You can then try more complex examples so you can figure out the correct way to produce it.
(Note that if was me I would try to eliminate this entire thing. But then I am not a big fan of weird database objects.)
Similar Messages
-
HELP IN Creating customized Oracle Object from Java
How can I create a customized oracle object that has these 3 fields with data persistance:
NAME : VARCHAR2
INSER_DATE : DATE
OBJ:user-defined collection(oracle.sql.array)
using JAVA. Later, that oracle object is enqueue in Oracle avanced Queue.
I've been looking in this site for the answer but had no luck.
I am using Java 1.2 and Oracle 8.1.6.
Any help will be appreciated as I needed so badly. Thanks.
Robby
[email protected]Hi
I assume your attempting to generate a Java class with the approriate getters and setters. If so the JPulisher utility is what your after. You can access it from either JDeveloper or the command line... Its documented in the Oracle Java manuals (jdbc etc.)...
A piece of advice... especially if you using AQ and ADT's or oracle's jms implementation against AQ, make sure you use the Oracle 8.1.7 jdbc drivers, even if your accessing an 8.1.6 DBMS. The performance difference is significant
Dom -
JDBC 8.1.6 Connection Pooling and Oracle Objects
I managed to make OracleConnectionCacheImpl class work and I noticed one very strange thing:
when I use simple SQL, connection cache works as good as single permanently opened connection but when I return Oracle objects with nested datasets in my result set performance degrades 10 times to compare to the same sql in case I am using single permanently opened connection.
I am using custom classess generated by JPublisher to access the objects
Example:
Single permanently opened connection
Simple SQL - 0.1 sec
Objects with nested datasets - 0.5 sec
Pooled connection
Simple SQL - 0.15 sec
Objects with nested datasets - 5 sec<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jason zheng ([email protected]):
OracleConnectionCacheImpl occ = new OracleConnectionCacheImpl();
occ.setURL("jdbc:oracle:thin:@xx.xx.xx.xx:1521:xxxx);
occ.setUser("xx");
occ.setPassword("xxx");
//optional
occ.setMaxLimit(3);
occ.setMinLimit(1);
.....//check api doc
//retrieve connection
Connection conn = occ.getConnection();
//close logical connection
conn.close()
//close phsical connection
occ.close();<HR></BLOCKQUOTE>
That's all fine and dandy until you try to use JNDI with it. If you create the instance and setMinLimit() when a client tries to get a connection from a JNDI lookup it throws an error saying something like: " user credentials don't match"
null -
Internal Error in reading a Table of Oracle custom-defined objects.
Hi,
We are running into an Oracle internal error when trying to extract data from an OUT parameter of a stored procedure. The OUT parameter is of the type TABLE of Oracle custom-defined OBJECT.
Any help on this issue will be greatly appreciated.
Thanks, in advance,
OraNew
Program:
package test;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import oracle.sql.ARRAY;
import oracle.sql.STRUCT;
import src.vo.ProfileBank;
public class TestOracle {
* @param args
public static void main(String[] args) {
try{
Connection con = getConnection();
ResultSet rsBalance = null;
CallableStatement cs =
con.prepareCall("{ CALL acr_profiles.get_profile_bank( ?, ?, ?)}");
cs.setLong(1, new Long(133).longValue());
cs.setLong(2, new Long(29032).longValue());
cs.registerOutParameter(3,Types.ARRAY,"ACR_USER." + "ACR_PROF_BANK_TAB");
cs.execute();
ARRAY array = (oracle.sql.ARRAY) cs.getObject(3);
System.out.println("length: "+ array.length());
System.out.println("isConvertible: " + array.isConvertibleTo(Object.class));
System.out.println("isInline: " + array.isInline());
rsBalance = array.getResultSet();
showResultSet(rsBalance);
} catch (Exception sql){
System.out.println("Exception "+ sql);
public static void showResultSet (ResultSet rs) throws SQLException
System.out.println("ResultSet = "+ rs.toString());
List profileBanks = new ArrayList();
while (rs != null && rs.next()) {
STRUCT struct = (STRUCT)rs.getObject (2); //getting the Internal Error on this line.
Object[] attribs = struct.getAttributes();
System.out.println("Bank Alias Id"+ (java.math.BigDecimal) attribs[0]);
System.out.println("Bank Name"+ (String)attribs[1]);
System.out.println("Bank set flag "+ (String) attribs[2]);
ProfileBank pBank = new ProfileBank();
pBank.setBankAliasId(new Integer(((java.math.BigDecimal) attribs[0]).intValue()));
pBank.setBankName((String) attribs[1]);
pBank.setSelBankFlag((String) attribs[2]);
profileBanks.add(pBank);
public static Connection getConnection() throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver loaded");
// establish a connection
Connection conn = DriverManager
.getConnection(
"jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=10.3.11.201)(Port=1521)) (CONNECT_DATA=(SERVICE_NAME= aada.a.al)))",
"acr_user", "acr_user");
System.out.println("Database connected");
return conn;
Console Output:
Driver loaded
Database connected
length: 2
isConvertible: false
isInline: true
ResultSet = oracle.jdbc.driver.ArrayDataResultSet@1f3aa07
Exception java.sql.SQLException: Internal Error
Partial Stacktrace obtained from the Eclipse Debug window:
oracle.jdbc.driver.DatabaseError.throwSqlException(int) line: 292
oracle.jdbc.oracore.OracleTypeCOLLECTION.initCollElemTypeName() line: 1192
oracle.jdbc.oracore.OracleTypeCOLLECTION.getAttributeType(int) line: 1225
oracle.jdbc.oracore.OracleTypeADT(oracle.jdbc.oracore.OracleNamedType).getFullName(boolean) line: 119
oracle.jdbc.oracore.OracleTypeADT(oracle.jdbc.oracore.OracleNamedType).getFullName() line: 93
oracle.sql.StructDescriptor(oracle.sql.TypeDescriptor).initSQLName() line: 497
oracle.sql.StructDescriptor(oracle.sql.TypeDescriptor).getName() line: 392
oracle.sql.StructDescriptor.getClass(java.util.Map) line: 2003
oracle.sql.STRUCT.toJdbc(java.util.Map) line: 983
oracle.jdbc.driver.ArrayDataResultSet.getObject(int, java.util.Map) line: 1379
oracle.jdbc.driver.ArrayDataResultSet.getObject(int) line: 1198
test.TestOracle.showResultSet(java.sql.ResultSet) line: 53
test.TestOracle.main(java.lang.String[]) line: 38
Environment:
Database: Oracle 10g (10.2.0.3)
JDBC Drivers: version 10.2.0.3 (ojdbc14, orai18n)
Database Server: HP-UX
Client machine: Windows XP
<end of thread>hi Thom,
most error relating to table DOKTL are caused by misconfigured network card.
if this is a "home" system, install a loopback adapter from Microsoft and use IP address 127.0.0.1 and also check "hosts" file for inconsistency. do not use the IP adddress provided by your ISP as it may change. -
Use of Complex Oracle Object with JDBC
How can I use Oracle Object(or PL/Sql type) with JDBC
I have a structure of record with some attributes and table of another attribute.
My types are defined as follows !
<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>
My custom object might have the following structure (or should it be different)
<code>
public class EmpColl implements CustomDatum, CustomDatumFactory
-- other stuff ----
/* fields */
public String empName;
public Collection empNos;
</code>
I want to pass an variable of type EMPLOYEES to an procedure.
Thanx in Advance
Chetan
[email protected]<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>The easiest is to use JPublisher (which comes with the SQLJ distribution).
Say:
jpub -user=username/password -sql=EMPLOYEES:Employees,EMPLOYEE_GRADES:EmployeeGrades
You will get (among others) the Java files Employees.java and EmployeeGrade.java. Go ahead, compile and use them.
Look in [Oracle Home]/sqlj/demo/jpub for a number of additional examples, and in the JPublisher User's Guide for background info.
The next (9.2) release of JPublisher will also provide some support for accessing legacy PL/SQL types from Java. -
Inserting oracle objects / collection using JDBC
Hi people,
I want to insert objects with collections(nested tables) into oracle database using my java JDBC. I believe there are two ways, one using strong types and the other as weak. I am using the weak types.
This is what I have got so far:
create or replace type town_ty as object(
name varchar2(20)
create or replace type country as object (
name varchar2(20),
towns town_ty
create table country_tab of country_ty;
Can any one kindly give or show me an example how to insert data into the above table using weak typed JDBC?
Thanks very muchHi
You should find what you are looking for in the samples provided here http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html.
HTH
Chris -
Oracle object, nested table on a subtype
Hello,
Is it possible to have a nested table on a subtype? If it is, can someone help me?
Here is what I need help for:
I have a supertype WORK, that have:
multivalued attribute ADDRESS
a attribute NAME, also the primary key
The subtype is called EMPLOYEE, that have:
multivalued attribute SPECIALTY
a attribute NAME
a attribute SSN
So far have I got:
//* The supertype *//
create or replace type ADRESS_TP as object(
ADRESS varchar2(50));
create or replace type ADRESSTP as table of ADRESS_TP;
create or replace WORK_TP as object(
NAME varchar2(30),
ADRESS ADRESSTP)
NOT FINAL;
create table WORK_TBL of WORK_TP(
Primary key(NAME))
nested table ADRESS store as NT_ADR(
(Primary key(nested_table_id, ADRESS))
organization index compress);
//* The subtype *//
create or replace type SPECIALTY_TP as object(
ADRESS varchar2(50));
create or replace type SPECIALTYTP as table of SPECIALTY_TP;
create or replace EMPLOYEE_TP under work_tp(
NAME varchar2(30),
SSN number)
FINAL;
The multivalued attribute SPECIALTYTP has to be declared in WORK_TBL have I been told, but how can I do that?
I'm using oracle 9iI'm not really sure what your problem is. In future please be specific about what it is you are trying to do and what it is that is not working. If it's an error please give us the error message and number. It's not the behaviour you are expecting please describe what it does. If it's that you simply don't understand please say what you don't understand.
I go on like this because the code you have posted is somewhat confusing. The Oracle object-oriented implementation is not quite complete so that makes it hard for people who know OO but don't know Oracle. Whereas most of us who know Oracle aren't expert in OO. Also, I think you should be slightly more inventive in your names: there's so many things called ADRESS it's easy to get them tangled up.
Anyway, here's my guess at what I think your problem is....
SQL> CREATE OR REPLACE TYPE adress_t AS OBJECT(
2 line1 VARCHAR2(50)
3 ,line2 VARCHAR2(50)
4 ,postcode VARCHAR2(8));
5 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE adress_nt AS TABLE OF adress_t;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE work_t AS OBJECT(
2 name VARCHAR2(30),
3 adresses adress_nt)
4 NOT FINAL;
5 /
Type created.
SQL> CREATE TABLE work_tbl OF work_t
2 NESTED TABLE adresses STORE AS adress_ntab
3 /
Table created.
SQL> CREATE OR REPLACE TYPE specialty_t AS OBJECT(
2 description VARCHAR2(50));
3 /
Type created.
SQL> CREATE OR REPLACE TYPE specialty_nt AS TABLE OF specialty_t;
2 /
Type created.
SQL>
SQL> ALTER TYPE work_t ADD ATTRIBUTE specialities specialty_nt CASCADE
2 /
Type altered.
SQL> DESC work_tbl
Name Null? Type
NAME VARCHAR2(30)
ADRESSES ADRESS_NT
SPECIALITIES SPECIALTY_NT
SQL> Cheers, APC -
Custom Mapping: Storing embedded objects to column of Oracle Object type
Hello,
How hard in your opinion it would be to write custome mapping to store an
embedded object which only have simple fields in it (no references to other
persistent classes) to oracle object column. What superclass is the best for
the job?
Simplest approach I see is to define "none" mapped class for my embedded
object and use transformation mapping to do the job
What if I need to reference other persistent objects in my embedded one - do
you think it will make any difference?
Thank you for your assistance
Alexoverriding loadProjection() took care of this issue
"Alex Roytman" <[email protected]> wrote in message
news:cjslsb$uo6$[email protected]..
Looks like transform mapping would not work - Kodo does not support object
mappings (use stream instead) or I am missing something?
"Alex Roytman" <[email protected]> wrote in message
news:cjshqv$ref$[email protected]..
Hello,
How hard in your opinion it would be to write custome mapping to store an
embedded object which only have simple fields in it (no references to
other persistent classes) to oracle object column. What superclass is the
best for the job?
Simplest approach I see is to define "none" mapped class for my embedded
object and use transformation mapping to do the job
What if I need to reference other persistent objects in my embedded one -
do you think it will make any difference?
Thank you for your assistance
Alex -
How to user jdbc visit oracle object type function?
1ãcreate oracle object
create type cocotestparam1 as object
(id number,
name varchar(10)
2ãadd function to object
alter type cocotestparam1 add member function test1(t number) return member;
3ãcreate object body
create type body cocotestparam1 as
memeber function test1(t number)
return number
is
begin
return t;
end;
end;
how can I visit the object cocotestparam1's function?
and how can I user jdbc visit the function?CallableStatement =
"DECLARE
a person_type;
BEGIN
a.load_object(4);
? := a;
END;"
And register as an out parameter.
Edited by: michael76 on 14.07.2010 05:01 -
Problem using Oracle Object Types and Arrays.
I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
Here's what I'm working with.
--Oracle Objects:
CREATE OR REPLACE TYPE dtl_obj AS OBJECT
detail_id INTEGER,
header_id INTEGER,
detail_desc VARCHAR2(300)
CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
CREATE OR REPLACE TYPE hdr_obj AS OBJECT
header_id INTEGER,
src VARCHAR(30),
details dtl_tab
CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
/--Java test methods
public static void main(String[] args) throws SQLException,
ClassNotFoundException
// Initialize the objects
Test t = new Test();
t.connect(); //Connects to the database
//The oracle connection will be accessible through t.conn
// Create the oracle call
String query = "{? = call get_header(?)}";
OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
int[] hdrs = { 240 }; //we just want one for testing.
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
"ARRAY_T", t.conn);
oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
cs.setARRAY(2, oHdrs); //Set the headers to retrieve
// Execute the query
cs.executeQuery();
try
ARRAY invArray = cs.getARRAY(1);
// Start the retrieval process
Class cls = Class.forName(Header.class.getName());
Map<String, Class<?>> map = t.conn.getTypeMap();
map.put(Header._SQL_NAME, cls);
Object[] invoices = (Object[]) invArray.getArray();
ArrayList<Header> invs = new ArrayList(
java.util.Arrays.asList(invoices));
if (invs != null)
for (Header inv : invs)
System.out.println(inv.getHeaderId() + " " + inv.getSrc());
t.addDetail(inv, "new line");
for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
// java.sql.SQLException: Fail to construct descriptor: Invalid arguments
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
// at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
// at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
// at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
// at com.pcr.tst.Detail.toDatum(Detail.java:40)
// at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
// at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
// at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
// at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
// at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
// at com.pcr.tst.Test.main(Test.java:91)
System.out.println(dtl.getDetailDesc());
catch (Exception ex)
System.out.println("Error while retreiving header");
ex.printStackTrace();
public void addDetail(Header hdr, String desc) throws Exception
if (hdr == null)
throw new Exception("header not initialized");
// Convert the current list to an ArrayList so we can easily add to it.
ArrayList<Detail> dtlLst = new ArrayList<Detail>();
dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
// Create the new detail
Detail dtl = new Detail();
dtl.setDetailDesc(desc);
// add the new detail
dtlLst.add(dtl);
Detail[] ies = new Detail[dtlLst.size()];
ies = dtlLst.toArray(new Detail[0]);
DetailTable iet = new DetailTable(ies);
hdr.setDetails(iet);
}I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
Message was edited by:
pcristiniOracle® Database Object-Relational Developer's Guide
Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course... -
Performance of mapping Oracle objects to Java classes
Hi,
By retrieving some test data from Oracle database in a Java application, I compared the traditional JDBC/RDBMS solution to JPublisher-generated-classes/Oracle-object-tables solution. The underlaying Oracle database and the client environment was the same in both tests. Although the table schemas were different, they represented the same data.
It seems that the traditional JDBC/RDBMS solution is much faster. Is this a reality or did I make a mistake somewhere?
BR,
TimoI am also facing performance overhead when using Jpub generated
classes for the object types.
I am using 817 jdbc and jpub but my database is 816. I have seen
that following statements each take around 2-3 seconds to
execute. Is there any communication between driver and database
to resolve the object type ?
Please help.
cCallableStatement =
(OracleCallableStatement)m_cConnection.prepareCall("{call
list_unsync_appts_array(?,?,?,?,?,?,?,?)}");
((OracleCallableStatement)cCallableStatement).setCustomDatum(1,ct_number_arr);
cCallableStatement.registerOutParameter(2,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(3,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
cCallableStatement.registerOutParameter(4,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(5,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
cCallableStatement.registerOutParameter(6,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(7,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
cCallableStatement.registerOutParameter(8,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
cCallableStatement.execute(); -
Oracle object cols and inserts
hi,
i have a type defined as follows
create type foo
a number(10),
b number(10),
c date, d date);
now i use this in a table as follows
create table test
foo_obj foo default foo(-1, -1, sysdate, sysdate) not null,
foo_name varchar2(100) not null
now what im really interested in is when i do
an insert id like to specify only some of
the values for a given obj
aka
insert into test(foo_obj, foo_name)
values (foo_obj.a(10), 'test')
so the rest of the values for that obj
come from the defaults specified..
ive been unable to find examples for the above method in the 8i docs & any help here
on the correct syntax with an example would
help enormously
thanx
pete
nullOracle® Database Object-Relational Developer's Guide
Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course... -
Help on accessing Oracle object !
Hi,
Looking for a help in accessing oracle object using JDBC. I've the following object defined in Oracle.
TYPE ty_ctg_prod AS OBJECT(
PROD VARCHAR2(40 ),
NODE_ID NUMBER ,
CTG_ID NUMBER );
TYPE ctg_PROD_ary AS VARRAY (50) OF ty_ctg_PROD;
The procedure out parameter is returning :
x_ctg_prod_ary OUT ctg_prod_ary
Do I need to use a OracleTypes.STRUCT API Or oracle.sql.ARRAY to access data in this scenario.
Any pointers will be highly appreciated.
Thanks,
Shamik// Get the object1 value from the second column col_object1
oracle.sql.STRUCT object1 = (oracle.sql.STRUCT)collabstatement.getObject(2);
// Get the object1 values from each row
Object[] object1Values = object1.getAttributes();
// Get the first value of object1, which is a string
String str = (String)object1Values[0];
// Get the second value of object1, which is of the type object2
oracle.sql.STRUCT object2 = (oracle.sql.STRUCT)object1Values[1];
// Get the values of object2
Object object2Values[] = object2.getAttributes();
str = (String)object2Values[0];
BigDecimal num = (BigDecimal)object2Values[1];you can also use :oracle.sql.Datum[] attrs = oracleSTRUCT.getOracleAttributes();more info :
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/objects/ObjectTypes.html -
Working with oracle object type tables
Hi,
I've created a table which only contains Oracle object types (e.g. CREATE TABLE x OF <...>). When I create an Entity for this table using the Entity wizard, I end up with an entity with the attributes of the base object type and two special attributes REF$ (reference to the object type instance) and SYS_NC_OID$ (unique object identifier). The REF$ attribute is on the Java side of type oracle.jbo.domain.Ref and the other attribute is on the Java side a simple String.
It seems this only allows me to save objects of the base type in this table. First of all in my situation this is also impossible because the base type is not instantiable. What I do want is to save several different subtypes into this table using the BC4J custom domain mechanism. Is there any way to make this possible? I first thought I could maybe do something with the special REF$ attribute, but this doesn't seem te case. So I might need to override most of the EntityImpl methods, like doUML, remove etc. Am I right? And does anyone have any hints on how to do this?
Regards,
PeterPeter:
Hi,
I've created a table which only contains Oracle
object types (e.g. CREATE TABLE x OF <...>).
When I create an Entity for this table using the
Entity wizard, I end up with an entity with the
attributes of the base object type and two special
attributes REF$ (reference to the object type
instance) and SYS_NC_OID$ (unique object identifier).
The REF$ attribute is on the Java side of type
oracle.jbo.domain.Ref and the other attribute is on
the Java side a simple String.
It seems this only allows me to save objects of the
base type in this table. First of all in my situation
this is also impossible because the base type is not
instantiable. What I do want is to save several
different subtypes into this table using the BC4J
custom domain mechanism. Is there any way to make
this possible? Sorry, but this is not supported out of the box.
Since you have an object table, you wouldn't use domains to achieve this. Instead, you would have a superclass and subclass entity objects, e.g., PersonEO subclassed into StudentEO and EmployeeEO.
I first thought I could maybe do
something with the special REF$ attribute, but this
doesn't seem te case. So I might need to override
most of the EntityImpl methods, like doUML, remove
etc. Am I right? And does anyone have any hints on
how to do this?
If you want, you can try this by overridding EntityImpl's:
protected StringBuffer buildDMLStatement(int operation,
AttributeDefImpl[] allAttrs,
AttributeDefImpl[] retCols,
AttributeDefImpl[] retKeys,
boolean batchMode)
and
protected int bindDMLStatement(int operation,
PreparedStatement stmt,
AttributeDefImpl[] allAttrs,
AttributeDefImpl[] retCols,
AttributeDefImpl[] retKeys,
HashMap retrList,
boolean batchMode) throws SQLException
Handle the case when operation == DML_INSERT.
There, build an insert statement with substitutable row, e.g.:
INSERT INTO persons VALUES (person_t('Bob', 1234));
INSERT INTO persons VALUES (employee_t('Joe', 32456, 12, 100000));
where person_t and employee_t are database types and you are invoking the respective constructor.
Thanks.
Sung -
ORACLE OBJECTS FOR OLE(OO4O) PERFORMANCE TUNING
제품 : ORACLE SERVER
작성날짜 : 1997-10-10
ODBC의 경우는 Block단위로 data를 Query하는데 비해 OLE의 경우는 한번에 전체
의 자료를 가져다가 Temporary storage space에 넣게 됩니다.
그래서 튜닝을 위해서는
Windows 3.1의 경우는 c:/windows/oraole.ini
WIN95의 경우는 HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\OO4O
parameters를 수정해야 합니다.
만일 위의 File이 없는 경우는 모든 변수가 Default로 설정된 경우이므로 인스톨
된 Help를 자세히 읽어보고 적용을 해야합니다.
FetchLimit이 가장 큰 영향을 끼치는 파라미터로, 일반적으로 이 값이 클수록
속도가 빨라지게 됩니다. 다음은 관련 자료입니다.
Tuning and Customization
A number of working parameters of Oracle Objects for OLE can be
customized. Access to these parameters is provided through the Oracle
initialization file, by default named ORAOLE.INI.
Each entry currently available in that file is described below. The location
of the ORAOLE.INI file is specified by the ORAOLE environment variable.
Note that this variable should specify a full pathname to the Oracle
initialization file, which is not necessarily named ORAOLE.INI. If this
environment variable is not set, or does not specify a valid file entry, then
Oracle Objects for OLE looks for a file named ORAOLE.INI in the Windows
directory. If this file does not exist, all of the default values
listed will apply.
You can customize the following sections of the ORAOLE.INI file:
[Cache Parameters]
A cache consisting of temporary data files is created to manage amounts
of data too large to be maintained exclusively in memory. This cache
is needed primarily for dynaset objects, where, for example, a single
LONG RAW column can contain more data than exists in physical
(and virtual) emory.
The default values have been chosen for simple test cases, running on a machine
with limited Windows resources. Tuning with respect to your machine and
applications is recommended.
Note that the values specified below are for a single cache, and that a separate
cache is allocated for each object that requires one. For example, if
your application contains three dynaset objects, three independent data
caches are constructed, each using resources as described below.
SliceSize = 256 (default)
This entry specifies the minimum number of bytes used to store a piece
of data in the cache. Items smaller than this value are allocated the
full SliceSize bytes for storage; items larger than this value are
allocated an integral multiple of this space value. An example of an
item to be stored is a field value of a dynaset.
PerBlock = 16 (default)
This entry specifies the number of Slices (described in the preceding
entry) that are stored in a single block. A block is the minimum unit
of memory or disk allocation used within the cache. Blocks are read
from and written to the disk cache temporary file in their entirety. Assuming a SliceSize of 256 and a PerBlock value of 16, then the block
size is 256 * 16 = 4096 bytes.
CacheBlocks = 20 (default)
This entry specifies the maximum number of blocks held in memory at any
one time. As data is added to the cache, the number of used blocks
grows until the value of CacheBlocks is reached. Previous blocks are
swapped from memory to the cache temporary disk file to make room for
more blocks. The blocks are swapped based upon recent usage. The total
amount of memory used by the cache is calculated as the product of
(SliceSize * PerBlock * CacheBlocks).
Recommended Values: You may need to experiment to find optimal cache parameter
values for your applications and machine environment. Here are some guidelines
to keep in mind when selecting different values:
The larger the (SliceSize * PerBlock) value, the more disk I/O is
required for swapping individual blocks. The smaller the (SliceSize * PerBlock) value, the
more likely it is that blocks will need to be swapped to or from disk.
The larger the CacheBlocks value, the more memory is required, but the
less likely it is that Swapping will be required.
A reasonable experiment for determining optimal performance might
proceed as follows:
Keep the SliceSize >= 128 and vary PerBlock to give a range of block
sizes from 1K through 8K.
Vary the CacheBlocks value based upon available memory. Set it high
enough to avoid disk I/O, but not so high that Windows begins swapping
memory to disk.
Gradually decrease the CacheBlocks value until performance degrades or
you are satisfied with the memory usage. If performance drops off,
increase the CacheBlocks value once again as needed to restore
performance.
[Fetch Parameters]
FetchLimit = 20 (default)
This entry specifies the number of elements of the array into which data
is fetched from Oracle. If you change this value, all fetched values
are immediately placed into the cache, and all data is retrieved from
the cache. Therefore, you should create cache parameters such that all
of the data in the fetch arrays can fit into cache memory. Otherwise,
inefficiencies may result.
Increasing the FetchLimit value reduces the number of fetches (calls
to the database) calls and possibly the amount of network traffic.
However, with each fetch, more rows must be processed before user
operations can be performed. Increasing the FetchLimit increases
memory requirements as well.
FetchSize = 4096 (default)
This entry specifies the size, in bytes, of the buffer (string) used for
retrieved data. This buffer is used whenever a long or long raw column
is initially retrieved.
[General]
TempFileDirectory = [Path]
This entry provides one method for specifying disk drive and directory
location for the temporary cache files. The files are created in the
first legal directory path given by:
1.The drive and directory specified by the TMP environment variable
(this method takes precedence over all others);
2.The drive and directory specified by this entry (TempFileDirectory)
in the [general] section of the ORAOLE.INI file;
3.The drive and directory specified by the TEMP environment variable; or
4.The current working drive and directory.
HelpFile = [Path and File Name]
This entry specifies the full path (drive/path/filename) of the Oracle Objects
for OLE help file as needed by the Oracle Data Control. If this entry cannot
be located, the file ORACLEO.HLP is assumed to be in the directory where
ORADC.VBX is located
(normally \WINDOWS\SYSTEM).제품 : ORACLE SERVER
작성날짜 : 1997-10-10
ODBC의 경우는 Block단위로 data를 Query하는데 비해 OLE의 경우는 한번에 전체
의 자료를 가져다가 Temporary storage space에 넣게 됩니다.
그래서 튜닝을 위해서는
Windows 3.1의 경우는 c:/windows/oraole.ini
WIN95의 경우는 HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\OO4O
parameters를 수정해야 합니다.
만일 위의 File이 없는 경우는 모든 변수가 Default로 설정된 경우이므로 인스톨
된 Help를 자세히 읽어보고 적용을 해야합니다.
FetchLimit이 가장 큰 영향을 끼치는 파라미터로, 일반적으로 이 값이 클수록
속도가 빨라지게 됩니다. 다음은 관련 자료입니다.
Tuning and Customization
A number of working parameters of Oracle Objects for OLE can be
customized. Access to these parameters is provided through the Oracle
initialization file, by default named ORAOLE.INI.
Each entry currently available in that file is described below. The location
of the ORAOLE.INI file is specified by the ORAOLE environment variable.
Note that this variable should specify a full pathname to the Oracle
initialization file, which is not necessarily named ORAOLE.INI. If this
environment variable is not set, or does not specify a valid file entry, then
Oracle Objects for OLE looks for a file named ORAOLE.INI in the Windows
directory. If this file does not exist, all of the default values
listed will apply.
You can customize the following sections of the ORAOLE.INI file:
[Cache Parameters]
A cache consisting of temporary data files is created to manage amounts
of data too large to be maintained exclusively in memory. This cache
is needed primarily for dynaset objects, where, for example, a single
LONG RAW column can contain more data than exists in physical
(and virtual) emory.
The default values have been chosen for simple test cases, running on a machine
with limited Windows resources. Tuning with respect to your machine and
applications is recommended.
Note that the values specified below are for a single cache, and that a separate
cache is allocated for each object that requires one. For example, if
your application contains three dynaset objects, three independent data
caches are constructed, each using resources as described below.
SliceSize = 256 (default)
This entry specifies the minimum number of bytes used to store a piece
of data in the cache. Items smaller than this value are allocated the
full SliceSize bytes for storage; items larger than this value are
allocated an integral multiple of this space value. An example of an
item to be stored is a field value of a dynaset.
PerBlock = 16 (default)
This entry specifies the number of Slices (described in the preceding
entry) that are stored in a single block. A block is the minimum unit
of memory or disk allocation used within the cache. Blocks are read
from and written to the disk cache temporary file in their entirety. Assuming a SliceSize of 256 and a PerBlock value of 16, then the block
size is 256 * 16 = 4096 bytes.
CacheBlocks = 20 (default)
This entry specifies the maximum number of blocks held in memory at any
one time. As data is added to the cache, the number of used blocks
grows until the value of CacheBlocks is reached. Previous blocks are
swapped from memory to the cache temporary disk file to make room for
more blocks. The blocks are swapped based upon recent usage. The total
amount of memory used by the cache is calculated as the product of
(SliceSize * PerBlock * CacheBlocks).
Recommended Values: You may need to experiment to find optimal cache parameter
values for your applications and machine environment. Here are some guidelines
to keep in mind when selecting different values:
The larger the (SliceSize * PerBlock) value, the more disk I/O is
required for swapping individual blocks. The smaller the (SliceSize * PerBlock) value, the
more likely it is that blocks will need to be swapped to or from disk.
The larger the CacheBlocks value, the more memory is required, but the
less likely it is that Swapping will be required.
A reasonable experiment for determining optimal performance might
proceed as follows:
Keep the SliceSize >= 128 and vary PerBlock to give a range of block
sizes from 1K through 8K.
Vary the CacheBlocks value based upon available memory. Set it high
enough to avoid disk I/O, but not so high that Windows begins swapping
memory to disk.
Gradually decrease the CacheBlocks value until performance degrades or
you are satisfied with the memory usage. If performance drops off,
increase the CacheBlocks value once again as needed to restore
performance.
[Fetch Parameters]
FetchLimit = 20 (default)
This entry specifies the number of elements of the array into which data
is fetched from Oracle. If you change this value, all fetched values
are immediately placed into the cache, and all data is retrieved from
the cache. Therefore, you should create cache parameters such that all
of the data in the fetch arrays can fit into cache memory. Otherwise,
inefficiencies may result.
Increasing the FetchLimit value reduces the number of fetches (calls
to the database) calls and possibly the amount of network traffic.
However, with each fetch, more rows must be processed before user
operations can be performed. Increasing the FetchLimit increases
memory requirements as well.
FetchSize = 4096 (default)
This entry specifies the size, in bytes, of the buffer (string) used for
retrieved data. This buffer is used whenever a long or long raw column
is initially retrieved.
[General]
TempFileDirectory = [Path]
This entry provides one method for specifying disk drive and directory
location for the temporary cache files. The files are created in the
first legal directory path given by:
1.The drive and directory specified by the TMP environment variable
(this method takes precedence over all others);
2.The drive and directory specified by this entry (TempFileDirectory)
in the [general] section of the ORAOLE.INI file;
3.The drive and directory specified by the TEMP environment variable; or
4.The current working drive and directory.
HelpFile = [Path and File Name]
This entry specifies the full path (drive/path/filename) of the Oracle Objects
for OLE help file as needed by the Oracle Data Control. If this entry cannot
be located, the file ORACLEO.HLP is assumed to be in the directory where
ORADC.VBX is located
(normally \WINDOWS\SYSTEM).
Maybe you are looking for
-
HT201320 How can I change my email address
Hey I have a very old email address would like to change it ! Thanks
-
The amount of settlement is not correct.
I have problem about the settlement of Process order that made the moving cost of our product is wrong. Step of Process Order show as below : 1. date 14.03.2011 17:21:39 => GR Finish Good => Totalamount of GR is -54,232.20 2. date 16.03.2011 09:17:3
-
TS2167 My web pages created in iWeb have disappeared
I finally completed the creation of a website in iWeb with some 30 pages last night and uploaded it to to the host GoDaddy. After upload I went to the URL for my website on GoDaddy and it looked fine. This morning when I opened my Domain.sites2 file
-
Sales District problem inn 2LIS_12_VCITM as its available in datasource
Dear All. i have modify the standard cube 0SD_C03 and added a Sales District in Organization dimension my requirement is to show the Incoming order quantity, Delivery quantity and Billing Quantity with respect to Sales District / Region. i am filling
-
Hi guys. As you probably know ive had gaming issues. I've just been on bt track a fault and it seems that yesterday 5/5/13@9:13am they updated this by highlighting the bt retail servers with multiple faults. What does this mean precisely? Finally the