문제

I was under the impression that Force.com eliminated the necessity of object-relational mapping.

I can't create a an object that extends a custom object like this:

class Program extends Program__C() { public Program() { super(); } }

So to "add a method to the Program__c() object" I have been doing this:

class Program { 
    Program__c program; 
    public Program() { 
        program = new Program__c(); 
    }
}

But then this leads to the same ERM problems that I thought Force was supposed to eliminate by virtue of the intercourse between APEX and the DB.

Is there any way to extend custom objects, or at least add methods to custom objects, in APEX? Am I incorrect in that developers don't have to do ORM?

Thank you,

-Matthew Mosien

도움이 되었습니까?

해결책

As far as I know (and I'm pretty certain), there is no way to extend custom objects in the manner you wish.

What you're doing seems to be a reasonable solution to the problem.

You don't have to do ORM in the sense that any objects and fields you have in your DB are already accessible in your code with no extra effort. However, you can't do much (if anything) to affect your schema programmatically in your code. You're kinda stuck with it.

Hope this helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top