Hi.

I'm new to JOOQ, and I have to admit I'm looking for "the right way to use 
it".
Here are a couple of questions: 

1. Is inheriting from a Record class a good idea?

Let's say I have a table A with an id field.
Without JOOQ, I would probably have something like:

class A { 
private int id;
public void setId(...) { ... }
public int getId() { ... }

// additional behaviour
}

With JOOQ, I feel I should do:

class A extends ARecord {
// additional behaviour
}

Does that seems to be ok?

Another way to do it would be:

class A { 
private ARecord aRecord;
public void setId(int id) { aRecord.setId(id); }
public int getId() { return aRecord.getId(); }

// additional behaviour
}

But that feels cumbersome to me.


2. Same question, but including PostgreSQL inheritance feature

As of now, I have 3 tables:
- parent
- childA inherits from parent
- childB inherits from parent

My Java objects are reflecting that tree :

class Parent { ... }
class childA extends parent { ... }
class childB extends parent { ... }

If I understand correctly, JOOQ does not handle PostgreSQL inheritance yet.
So, I do not find a clean way to use these table. Of course, the Java 
children reuse some Parent behaviour.

>From my first question, the cumbersome version should work:

class Parent { 
    private ParentRecord parentRecord;
}
class childA extends parent {
    private ChildARecord childARecord;
}
class childB extends parent {
    private ChildBRecord childBRecord;
}

But that feels even more wrong.

I hope you guys will have better constructs to offer :).


Adrien.

-- 
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/d/optout.

Reply via email to