Re: entity Qualifiers and enums

John Huss <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CAOUwSGurPcYysY8xVVgtxEdmcQX01s=ZmHrJzNe1D8Mg=TNsww@mail.gmail.com>
Some more info would probably help us to understand what you're doing.

Is this a java enum? Or just a group of java constants?

How are you storing it in the DB? With the string value of the enum
constants? Or with the ordinal value or int constant value?

I believe the answers are:
1) Yes, you have to set it yourself, which is true of all non-primitive
fields.
2) If you set to the wrong value
     - If using enums, it should blow up when you read the row back from
the DB
     - If using int constants, it will just be wrong, but no exceptions.


On Tue, Oct 1, 2019 at 3:23 PM Tony Giaccone <[email protected]> wrote:

> I have two objects, that are based on the same table. I want to
> differentiate them by using a qualifier.
>
> I'm using a qualifer that looks like accountType = AccountType.hdaccount
>
> where hdaccount is one of the enumerated values.
>
> When i create an object of this type, the field is set to null. Is that
> typical? Do I have to explicitly set it myself, if so what happens if I set
> it to the wrong value?
>
> Tony Giaccone
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.