I really need someone to help me with this. 

Here is the Query that I am generating:
        select distinct * from user_view ORDER BY lname;

When I execute this query directly inside the database I get the desired
results. 

I then use the following code to execute it.
       try {
            broker.beginTransaction();
                // This collection is always empty. Rats
            Collection collect =
((Collection)broker.getCollectionByQuery(query));
            broker.commitTransaction();
            
        } catch (Exception exc) {
            exc.printStackTrace();
        }


Here is my mapping from the repository file, user_view is the view which
I created. I just picked the first field to be a primary key to avoid
the "hey I need a primary key" error.

   <class-descriptor
      class="com.cadence.apps.cadencepdk.model.UserView"
      table="user_view" >

      <field-descriptor id="1"
         name           ="email"
         column         ="email"
         jdbc-type      ="VARCHAR"
           primarykey   ="true"/>

      <field-descriptor id="2"
         name           ="fname "
         column         ="fname "
         jdbc-type      ="VARCHAR"/>

      <field-descriptor id="3"
         name           ="lname"
         column         ="lname"
         jdbc-type      ="VARCHAR"/>

      <field-descriptor id="4"
         name           ="compName"
         column         ="comp_name"
         jdbc-type      ="VARCHAR"/>

      <field-descriptor id="5"
         name           ="apprved"
         column         ="apprved"
         jdbc-type      ="BIT"/>
   </class-descriptor>


I created the view with 
CREATE VIEW public.user_view AS SELECT users.email, users.fname,
users.lname, companies.comp_name, users.apprved FROM users WHERE
(((users.location_id)::text = (locations.location_id)::text) AND
(companies.cmp_id = locations.cmp_id));



-----Original Message-----
From: Raymond Lukas 
Sent: Thursday, January 02, 2003 5:02 PM
To: [EMAIL PROTECTED]
Subject: Mapping objects from a view, not a table

I need to map objects which come from a view, not a real table. Can I do
that?

What happens to the "required" object id in the repository file. I will
not have one since this is a view and not a real table. 

 

Note:

I am using views because I was not able to efficiently use multiple
inter-linked tables. 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to