2013/10/16 Peter Cooner <[email protected]>
>
> On Wed, Oct 16, 2013 at 3:17 AM, Lukas Eder <[email protected]> wrote:
>
>>
>>
>> 2013/10/15 Peter Cooner <[email protected]>
>>
>>> Honestly PG inheritance was pretty bad in 8.X, and only started to rock
>>> in 9.X, I'm thinking there isn't a lot of real multiple inheritance in use
>>> out there (that doesn't mean there won't be of course).
>>>
>>
>> Well, a good use case that I could see is to define something mixin types
>> for very common attribute sets, such as DATE_CREATED, DATE_MODIFIED,
>> USER_CREATED, USER_MODIFIED. Such attributes could be declared in a base
>> table / type and then inherited by all relevant tables, which can also
>> inherit from other structures. I'm not particularly experienced with such
>> an ORDBMS way of thinking, but it would certainly be interesting to
>> experiment with that.
>>
>
>
> Hah. Yesterday I accidentally a word. I meant to write "Honestly PG
> inheritance performance was pretty bad in 8.X". Sorry about that.
>
Between the lines, I was actually reading precisely that :-)
> I think you've made an excellent example.
>
> And when I was working in JOOQ on my own inherited tables, I really wanted
> to be able to to do things such as:
>
> Result<BaseRecord> results;
> results = create.selectFrom(Tables.CHILD_TABLE)....
>
> or
>
> BaseRecord br = .... ChildTable ...
>
> But I got over all that pretty quickly because I realized that usually
> what I really needed to do was to push data (or type) from ChildRecord into
> a BaseRecord or from ChildA into ChildB which had the same columns.
>
> Besides that the table classes generated already extend a class so I think
> a different solution is in order.
>
> Which brings me back to mapping...
>
>
>
>> Anyway, I'm wondering if maybe some of those mapping functions in JOOQ
>>> couldn't be the best solution? My brain is fuzzy on the topic, but aren't
>>> the values are kept in a store, might there be a "fast" way to map between
>>> one table type and another? Maybe some sort of internal JOOQ table hinting
>>> would allow for quicker mapping, or re-typing as the case might be...
>>>
>>
>> What do you mean by "those mapping functions" ?
>>
>
> Ah yes, I meant on a result set there are the map() and into(Table<R>)
> functions which map data from one to another.
>
> I guess the point of all this was to say that I can't see a good way for
> JOOQ to do this within the Java type system, so maybe a good helper is more
> useful then a perfect type-safe solution?
>
Hmm, you mean like generating "helper" methods such as:
public class ParentTableRecord {
public ChildTableRecord intoChildTable() {
return into(CHILD_TABLE);
}
}
public class ChildTableRecord {
public ParentTableRecord intoParentTable() {
return into(PARENT_TABLE);
}
}
That would probably be quite useful... I've registered #2782 for this.
https://github.com/jOOQ/jOOQ/issues/2782
Let me know if you see other useful additions.
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.