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

Pinned topic What to use instead of setWhere()?

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


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

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

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



  • Dex_
    34 Posts

    Re: What to use instead of setWhere()?


    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.


  • bportaluri
    67 Posts

    Re: What to use instead of setWhere()?


    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.



  • Macksimo
    11 Posts

    Re: What to use instead of setWhere()?


    Thank you guys! Really helped!