Thanks Lukas, 

i think my question is too specific to my concrete project,
and it was not the right place to ask. 

All your named approaches are good!
And so i'm fine with this question.

Also: this is one of those very small problems that are not really a 
game-changer, 
but only something one battles with even though, everything is already good 
enough :D

[email protected] schrieb am Montag, 4. November 2024 um 06:46:08 UTC:

> A jOOλ is a Java-style structural type, like Scala knows them. A jOOQ 
> Record is a database record. It seems to me that they have well defined 
> purposes and yet are generic enough to be used for whatever you think you 
> want to do with them. Likewise, there's Map<K, V> in the JDK, but no one 
> prevents you from using a List<Entry<K, V>> if your "map" focuses more on 
> iteration use-cases than deduplication and random O(1) access use-cases.
>
> As such, I don't really know what you're asking here. Are you asking if 
> it's OK for you to use structural types as opposed to nominal ones (e.g. 
> Java records)? You won't get an authoritative answer here or anywhere.
>
> On Sat, Nov 2, 2024 at 10:33 AM 'Bernd Huber' via jOOQ User Group <
> [email protected]> wrote:
>
>> just to give a practical example, when such Tuple can be helpful in a 
>> typical SaaS that needs to work with JSON-columns.
>>
>> ---
>>
>> When a new "Report" entry is created, the column "reportContentJson" must 
>> be filled with a nested json object consisting of specific! (not all) data 
>> from multiple other tables.
>>
>> There is already an existing Repository that collects all relevant nested 
>> data from the multiple other tables as "Nested DTOs"
>>
>> But for backwards-compatibility reasons the nested json must be "frozen" 
>> in regards to specific content (it should not contain all content)
>> So there are additional Nested DTOs needed, that only contain the data 
>> that is relevant to save into the json.
>>
>> And now, when i want to create the NestedDTOs for the JSON-column from 
>> the NestedDTOs that contain all data,
>> the Tuple1, Tuple2, ..., TupleN can help me to create static constructors 
>> for creating the objects.
>>
>> For example
>>
>> class ReportContentJson {
>>    ...
>>    public static Nested1 create(Tuple2<SourceDTO, SubSourceDTO> rec) {
>>       return new Nested1()
>>          
>> .setReportContentSourceJson(ReportContentSourceJson.from(rec.value1()))
>>          
>> .setReportContentSubSourceJson(ReportContentSubSource.from(rec.value2()));
>>    }
>> }
>>
>> class ReportContentSourceJson {
>>     ....
>>     public static ReportContentSourceJson from(SourceDTO dto) {
>>         return new ReportContentSourceJson()
>>             .setField1(dto.getField1())
>>             .setField2(dto.getField2());
>>     }
>> }
>>
>> Bernd Huber schrieb am Freitag, 1. November 2024 um 15:11:19 UTC:
>>
>>> when working with jOOQ, i embraced the use of Record1, Record2, ..., 
>>> RecordN when i pulled data out of the database, and used the convertFrom of 
>>> jooq where i convert those RecordN instances to my DTOs
>>>
>>> All in all i found it great to work that way.
>>>
>>> Java does not have Tuples (like RecordN) out of the box.
>>>
>>> Sometimes i create DTOs outside of the database-context,
>>> and it seems that RecordN can not be instantiiated manually so easily.
>>>
>>> I found the Tuple1, Tuple2, ..., TupleN in the jOOλ library, and they 
>>> seem to provide exactly what i need (using tuples that can be used 
>>> everywhere in the project for different purposes).
>>>
>>> Now, is there something in the jOOQ library already that i can use, or 
>>> is it good to use the jOOλ library for this purpose? 
>>>
>>>
>>>
>>>
>>> -- 
>> 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].
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/jooq-user/8fd8fd32-7872-4635-bb97-4ad79ab48bc1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jooq-user/8fd8fd32-7872-4635-bb97-4ad79ab48bc1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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].
To view this discussion visit 
https://groups.google.com/d/msgid/jooq-user/be390f43-52f1-4077-be32-341fd92855cdn%40googlegroups.com.

Reply via email to