Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Object Views
Untested, but how about
select VALUE(r) from user_view r where r.userid = <whatever>
John.
"Jens Baumeister" <invalid_at_spam.no> wrote in message
news:9dh3jh$r55$1_at_news.netcologne.de...
> 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),
> firstname VARCHAR2(50),
> email VARCHAR2(100) NOT NULL
> );
>
> This is the corrseponding object:
>
> create type user_obj as object (
> userID NUMBER,
> userName VARCHAR2(20),
> password VARCHAR2(20),
> lastName VARCHAR2(50),
> firstName VARCHAR2(50),
> email VARCHAR2(100)
> );
>
> 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,
> firstname,
> email
> from users;
>
> 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 Mon May 14 2001 - 19:29:38 CDT
![]() |
![]() |