Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Object Views
Hi,
I'm using Oracle 8i on Linux and I want to map table data into object views for easier JDBC access (mapping Oracle objects right into Java objects). I followed Oracle directions (mirrored e.g. on http://www-rohan.sdsu.edu/doc/oracle/server803/A54643_01/ch_objvw.htm ), but it doesn't work right.
This is my table:
create table users (
pk_id NUMBER,
username VARCHAR2(20) NOT NULL, password VARCHAR2(20) NOT NULL, lastName VARCHAR2(50),
This is the corrseponding object:
create type user_obj as object (
userID NUMBER,
userName VARCHAR2(20), password VARCHAR2(20), lastName VARCHAR2(50),
and that's the object view:
create or replace view user_view of user_obj
with object OID (userid) as
select pk_id,
username, password, lastname,
When I do a select * on the object view, I get the data just as if it were a normal view, i.e there's no object that wraps them, just data columns.
The same happens when I access the view from JDBC using rs.getObject(1) - I don't get the complete thing in an Oracle object of type user_obj, instead I get just the first column (userid) as an integer and I can access the othercolumns with getObject(2) etc.
How do I map the table data into an object view that gives me a single object of type user_obj for each row?
Thanks for any help.
Jens Baumeister Received on Fri May 11 2001 - 11:22:59 CDT