Topic
  • 3 replies
  • Latest Post - ‏2014-02-25T10:06:13Z by Macksimo
Macksimo
Macksimo
11 Posts

Pinned topic What to use instead of setWhere()?

‏2014-02-12T21:06:10Z |

Hello,

I use myobj.setWhere("condition = 1");

But i'd like to be able to use a method that accepts a SQL statement, like this: myobj.xxx("select * from mytable where condition = 1");

It is a bit hard to use setWhere() when it comes to joins!

 

Thanks!

  • Dex_
    Dex_
    34 Posts

    Re: What to use instead of setWhere()?

    ‏2014-02-14T02:44:56Z  

    That's just the way the Maximo framework works. If you need fields from another object, then you need to actually fetch the other object (or create a view, if you are fetching the same data the same way often). If you want to limit your set based on the joins, then you need to use sub-queries in your where clause. Within Maximo, you simply don't have access to anything but the "where" clause. Other ORMs have a bit more flexibility, but primarily act the same way.

    -Dex

  • bportaluri
    bportaluri
    60 Posts

    Re: What to use instead of setWhere()?

    ‏2014-02-17T17:50:08Z  

    You can navigate from the main object to related tables using relationships as described here.

    If you really need to perform SQL statements you may use this technique.

    Regards

      MaximoDev

  • Macksimo
    Macksimo
    11 Posts

    Re: What to use instead of setWhere()?

    ‏2014-02-25T10:06:13Z  

    Thank you guys! Really helped!