No, the table is not pre populated. I would like to avoid inserting data
other way than through the application code.
I do believe that inserting two entries is a good solution. But how to
control that in the application code?

Thanks for helping.

Luiz Fernando


2008/10/8 Vincent Ramdhanie <[EMAIL PROTECTED]>

> Do you have your preferred ship table pre populated with data? In that case
> why not add ANY and NONE as two entries rather than making them static final
> objects. So the combo box will display all data in the preferred ship table
> including ANY and NONE and there, you do not have to treat them differently.
>
> Just a thought.
>
> Vincent
>
>
> On Wed, Oct 8, 2008 at 11:12 AM, Luiz Fernando Rodrigues <
> [EMAIL PROTECTED]> wrote:
>
>> Hi there,
>>
>>  I'm mapping my application to a database usinf JPA tags. I'm with the
>> following situation:
>>
>> I have a class Product which has an attribute preferedShip, from the class
>> Ship.
>> In the interface, the user chooses a ship from a combobox. The combo lists
>> all the registered ships and two more options: ANY and NONE.
>>
>> I have modeled ANY and NONE as static final objects of the type Ship,
>> because, like this I don't have to treat each case apart. Any and none are
>> Ships them.
>>
>> Well, the problem is to persist this code. To save a product with
>> preferedShip as ANY or NONE I will have to reference one of the two objects.
>> But they are not persisted, because I modeled it as static final objects.
>> If I map it to the database I'll have to hard code an id in the objects.
>>
>> Is this a good solution? Does anyone see any better solution?
>>
>> thanks,
>> Luiz Fernando
>>
>
>

Reply via email to