Mapping oracle objects into java
843859Oct 10 2006 — edited Oct 11 2006Hello, i have done a database with oracle xe edition, and i need to insert/modify/del/view data from jsp pages. I wanted to map objects declared on the db as java objects too, so i could browse resultset getting obects directly as java objects.
I tried to figure out what it's needed but i couldn't succesfully got a clear knowledge of what to do :(
For example, i have those:
"CREATE OR REPLACE TYPE t_address AS OBJECT (road VARCHAR2(20), city VARCHAR2(20))",
"CREATE OR REPLACE TYPE t_addresses AS TABLE of REF t_address"
"CREATE OR REPLACE TYPE t_person AS OBJECT (name VARCHAR2(5), addresses t_addresses)",
"CREATE OR REPLACE TYPE t_teacher UNDER t_person (subject VARCHAR2(30))"
"CREATE OR REPLACE TYPE t_student UNDER t_person (age VARCHAR(2))",
"CREATE TABLE people OF t_person (PRIMARY KEY (name) ENABLE) NESTED TABLE addresses STORE AS addresses_nested"
can somebody show me how to build java types for that situation and how to get the result of something like "SELECT addresses FROM people WHERE name = 'somebody'", in other words how to handle nested table of refs.
Thanks very much for the attention given.