Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves to Jakarta #486

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Moves to Jakarta #486

wants to merge 1 commit into from

Conversation

froque
Copy link
Member

@froque froque commented Nov 7, 2023

fixes #157

@froque froque added this to the billy-10 milestone Nov 7, 2023
@@ -33,7 +34,8 @@ public AndorraPersistenceDependencyModule(String persistenceUnitId) {

@Override
protected void configure() {
JpaPersistModule persistModule = new JpaPersistModule(this.persistenceUnitId);
final var options = JpaPersistOptions.builder().setAutoBeginWorkOnEntityManagerCreation(true).build();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason for this change? Was the default behavior before to auto start work when the entity manager was created but the new version does not do this?

Consider this question as applying to the equivalent change in the other modules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/google/guice/wiki/Guice600#persist

Persist had a number of changes, some of which are backwards incompatible. Notably: injection of EntityManager no longer implicitly starts a unit of work (because this led to leaks). Users can opt-in to the legacy behavior by constructing the JpaPersistModule with a JpaPersistOptions that sets setAutoBeginWorkOnEntityManagerCreation to true.

I was trying to keep the same behavior and only perform a javax -> jakarta change.

@froque
Copy link
Member Author

froque commented Dec 6, 2023

This is failling:

    public static void main(String[] args) {

        final var options = JpaPersistOptions.builder().setAutoBeginWorkOnEntityManagerCreation(true).build();
        Injector injector = Guice.createInjector(new PortugalDependencyModule(),
                new SpainDependencyModule(),
                new AndorraDependencyModule(),
                new JpaPersistModule("application-persistence-unit", options));

        injector.getInstance(PersistService.class).start();

        var uid = "a998f2d8-76a0-4fe3-b820-56bb45dc95fb";
        DAOPTInvoice daoPTInvoice = injector.getInstance(DAOPTInvoice.class);
        PTInvoiceEntity entity = daoPTInvoice.get(StringID.fromValue(uid));
        System.err.println(entity.getEntries());

        injector.getInstance(PersistService.class).stop();
    }

with:

ERROR: ERROR: target lists can have at most 1664 entries
Exception in thread "main" org.hibernate.exception.GenericJDBCException: JDBC exception executing SQL [select e1_0.ID_INVOICE,e1_1.ID,case when e1_2.ID is not null then 2 when e1_3.ID is not null then 3 when e1_4.ID is not null then 5 when e1_5.ID is not null then 6 when e1_6.ID is not null then 7 when e1_7.ID is not null then 8 when e1_8.ID is not null then 10 when e1_9.ID is not null then 11 when e1_10.ID is not null then 12 when e1_11.ID is not null then 13 when e1_12.ID is not null then 1 when e1_13.ID is not null then 4 when e1_14.ID is not null then 9 when e1_1.ID is not null then 0 end,e1_1.ACTIVE,e1_1.AMOUNT_WITH_TAX,e1_1.AMOUNT_WITHOUT_TAX,e1_1.CREATE_TIMESTAMP,e1_1.CREDIT_OR_DEBIT,e1_1.CURRENCY,e1_1.DESCRIPTION,e1_1.DISCOUNT_AMOUNT,e1_1.ENTITY_VERSION,e1_1.EXCHANGE_RATE_TO_DOCUMENT_CURRENCY,e1_1.NUMBER,p1_0.ID,case when p1_1.ID is not null then 1 when p1_2.ID is not null then 2 when p1_3.ID is not null then 3 when p1_0.ID is not null then 0 end,p1_0.ACTIVE,p1_0.COMMODITY_CODE,p1_0.CREATE_TIMESTAMP,p1_0.DESCRIPTION,p1_0.ENTITY_VERSION,p1_0.PRODUCT_GROUP,p1_0.NUMBER_CODE,p1_0.PRODUCT_CODE,p1_0.TYPE,p1_0.UID,p1_0.UNIT_OF_MEASURE,p1_0.UPDATE_TIMESTAMP,p1_0.VALUATION_METHOD,e1_1.QUANTITY,e1_1.SHIPPING_COSTS_AMOUNT,e1_1.TAX_AMOUNT,e1_1.TAX_EXEMPTION_CODE,e1_1.TAX_EXEMPTION_REASON,e1_1.TAX_POINT_DATE,e1_1.AMOUNT_TYPE,e1_1.UID,e1_1.UNIT_AMOUNT_WITH_TAX,e1_1.UNIT_AMOUNT_WITHOUT_TAX,e1_1.UNIT_DISCOUNT_AMOUNT,e1_1.UNIT_OF_MEASURE,e1_1.UNIT_TAX_AMOUNT,e1_1.UPDATE_TIMESTAMP,ir1_0.ID,case when ir1_1.ID is not null then 9 when ir1_0.ID is not null then 8 when ir1_2.ID is not null then 6 when ir1_3.ID is not null then 0 end,ir1_3.ACTIVE,ir1_3.AMOUNT_WITH_TAX,ir1_3.AMOUNT_WITHOUT_TAX,ir1_3.BATCH_ID,b1_0.ID,case when b1_1.ID is not null then 1 when b1_2.ID is not null then 2 when b1_3.ID is not null then 3 when b1_0.ID is not null then 0 end,b1_0.ACTIVE,a1_0.ID,case when a1_1.ID is not null then 1 when a1_2.ID is not null then 2 when a1_3.ID is not null then 3 when a1_0.ID is not null then 0 end,a1_0.ACTIVE,a1_0.BUILDING,a1_0.CITY,a1_0.COUNTRY,a1_0.CREATE_TIMESTAMP,a1_0.DETAILS,a1_0.ENTITY_VERSION,a1_0.NUMBER,a1_0.POSTAL_CODE,a1_0.REGION,a1_0.STREET_NAME,a1_0.UID,a1_0.UPDATE_TIMESTAMP,ba1_0.ID,case when ba1_1.ID is not null then 1 when ba1_2.ID is not null then 2 when ba1_3.ID is not null then 3 when ba1_0.ID is not null then 0 end,ba1_0.ACTIVE,ba1_0.BUILDING,ba1_0.CITY,ba1_0.COUNTRY,ba1_0.CREATE_TIMESTAMP,ba1_0.DETAILS,ba1_0.ENTITY_VERSION,ba1_0.NUMBER,ba1_0.POSTAL_CODE,ba1_0.REGION,ba1_0.STREET_NAME,ba1_0.UID,ba1_0.UPDATE_TIMESTAMP,b1_0.COMMERCIAL_NAME,b1_0.CREATE_TIMESTAMP,b1_0.ENTITY_VERSION,mc1_0.ID,case when mc1_1.ID is not null then 1 when mc1_2.ID is not null then 2 when mc1_3.ID is not null then 3 when mc1_0.ID is not null then 0 end,mc1_0.ACTIVE,mc1_0.CREATE_TIMESTAMP,mc1_0.EMAIL,mc1_0.ENTITY_VERSION,mc1_0.FAX,mc1_0.MOBILE,mc1_0.NAME,mc1_0.PHONE,mc1_0.UID,mc1_0.UPDATE_TIMESTAMP,mc1_0.WEBSITE,b1_0.NAME,oc1_0.ID,case when oc1_1.ID is not null then 1 when oc1_2.ID is not null then 2 when oc1_3.ID is not null then 3 when oc1_0.ID is not null then 0 end,oc1_0.ACTIVE,oc1_0.CREATE_TIMESTAMP,oc1_0.DESCRIPTION,oc1_0.ENTITY_VERSION,oc1_0.NAME,p2_0.ID,case when p2_1.ID is not null then 1 when p2_2.ID is not null then 2 when p2_3.ID is not null then 3 when p2_0.ID is not null then 0 end,p2_0.ACTIVE,p2_0.CREATE_TIMESTAMP,p2_0.DESCRIPTION,p2_0.ENTITY_VERSION,p2_0.NAME,p2_0.ID_CONTEXT_PARENT,p2_0.UID,p2_0.UPDATE_TIMESTAMP,p2_1.REGION_CODE,oc1_0.UID,oc1_0.UPDATE_TIMESTAMP,oc1_1.REGION_CODE,sa1_0.ID,case when sa1_1.ID is not null then 1 when sa1_2.ID is not null then 2 when sa1_3.ID is not null then 3 when sa1_0.ID is not null then 0 end,sa1_0.ACTIVE,sa1_0.BUILDING,sa1_0.CITY,sa1_0.COUNTRY,sa1_0.CREATE_TIMESTAMP,sa1_0.DETAILS,sa1_0.ENTITY_VERSION,sa1_0.NUMBER,sa1_0.POSTAL_CODE,sa1_0.REGION,sa1_0.STREET_NAME,sa1_0.UID,sa1_0.UPDATE_TIMESTAMP,b1_0.TAX_ID,b1_0.TAX_ID_COUNTRY,b1_0.timezone,b1_0.UID,b1_0.UPDATE_TIMESTAMP,b1_0.WEBSITE,ir1_3.CASH_VAT_ENDORSER,ir1_3.CREATE_TIMESTAMP,ir1_3.CREDIT_OR_DEBIT,ir1_3.CURRENCY,c1_0.ID,case when c1_1.ID is not null then 1 when c1_2.ID is not null then 2 when c1_3.ID is not null then 3 when c1_0.ID is not null then 0 end,c1_0.ACTIVE,ba2_0.ID,case when ba2_1.ID is not null then 1 when ba2_2.ID is not null then 2 when ba2_3.ID is not null then 3 when ba2_0.ID is not null then 0 end,ba2_0.ACTIVE,ba2_0.BUILDING,ba2_0.CITY,ba2_0.COUNTRY,ba2_0.CREATE_TIMESTAMP,ba2_0.DETAILS,ba2_0.ENTITY_VERSION,ba2_0.NUMBER,ba2_0.POSTAL_CODE,ba2_0.REGION,ba2_0.STREET_NAME,ba2_0.UID,ba2_0.UPDATE_TIMESTAMP,c1_0.CREATE_TIMESTAMP,c1_0.ENTITY_VERSION,ma1_0.ID,case when ma1_1.ID is not null then 1 when ma1_2.ID is not null then 2 when ma1_3.ID is not null then 3 when ma1_0.ID is not null then 0 end,ma1_0.ACTIVE,ma1_0.BUILDING,ma1_0.CITY,ma1_0.COUNTRY,ma1_0.CREATE_TIMESTAMP,ma1_0.DETAILS,ma1_0.ENTITY_VERSION,ma1_0.NUMBER,ma1_0.POSTAL_CODE,ma1_0.REGION,ma1_0.STREET_NAME,ma1_0.UID,ma1_0.UPDATE_TIMESTAMP,mc2_0.ID,case when mc2_1.ID is not null then 1 when mc2_2.ID is not null then 2 when mc2_3.ID is not null then 3 when mc2_0.ID is not null then 0 end,mc2_0.ACTIVE,mc2_0.CREATE_TIMESTAMP,mc2_0.EMAIL,mc2_0.ENTITY_VERSION,mc2_0.FAX,mc2_0.MOBILE,mc2_0.NAME,mc2_0.PHONE,mc2_0.UID,mc2_0.UPDATE_TIMESTAMP,mc2_0.WEBSITE,c1_0.NAME,c1_0.SELF_BILLING,sa2_0.ID,case when sa2_1.ID is not null then 1 when sa2_2.ID is not null then 2 when sa2_3.ID is not null then 3 when sa2_0.ID is not null then 0 end,sa2_0.ACTIVE,sa2_0.BUILDING,sa2_0.CITY,sa2_0.COUNTRY,sa2_0.CREATE_TIMESTAMP,sa2_0.DETAILS,sa2_0.ENTITY_VERSION,sa2_0.NUMBER,sa2_0.POSTAL_CODE,sa2_0.REGION,sa2_0.STREET_NAME,sa2_0.UID,sa2_0.UPDATE_TIMESTAMP,c1_0.TAX_ID,c1_0.TAX_ID_COUNTRY,c1_0.UID,c1_0.UPDATE_TIMESTAMP,c1_2.REFERRAL_NAME,c1_1.REFERRAL_NAME,c1_3.REFERRAL_NAME,ir1_3.DATE,ir1_3.DISCOUNTS_AMOUNT,ir1_3.ENTITY_VERSION,ir1_3.GENERAL_LEDGER_DATE,ir1_3.LOCAL_DATE,ir1_3.NUMBER,ir1_3.OFFICE_NUMBER,ir1_3.PAYMENT_TERMS,ir1_3.SCALE,ir1_3.SELF_BILLED,ir1_3.SERIES,ir1_3.SERIES_NUMBER,ir1_3.SETTLEMENT_DATE,ir1_3.SETTLEMENT_DESCRIPTION,ir1_3.SETTLEMENT_DISCOUNT,sd1_0.ID,case when sd1_1.ID is not null then 1 when sd1_2.ID is not null then 2 when sd1_3.ID is not null then 3 when sd1_0.ID is not null then 0 end,sd1_0.ACTIVE,a2_0.ID,case when a2_1.ID is not null then 1 when a2_2.ID is not null then 2 when a2_3.ID is not null then 3 when a2_0.ID is not null then 0 end,a2_0.ACTIVE,a2_0.BUILDING,a2_0.CITY,a2_0.COUNTRY,a2_0.CREATE_TIMESTAMP,a2_0.DETAILS,a2_0.ENTITY_VERSION,a2_0.NUMBER,a2_0.POSTAL_CODE,a2_0.REGION,a2_0.STREET_NAME,a2_0.UID,a2_0.UPDATE_TIMESTAMP,sd1_0.CREATE_TIMESTAMP,sd1_0.DATE,sd1_0.DELIVERY_ID,sd1_0.ENTITY_VERSION,sd1_0.LOCATION_ID,sd1_0.UCR,sd1_0.UID,sd1_0.UPDATE_TIMESTAMP,sd1_0.WAREHOUSE_ID,so1_0.ID,case when so1_1.ID is not null then 1 when so1_2.ID is not null then 2 when so1_3.ID is not null then 3 when so1_0.ID is not null then 0 end,so1_0.ACTIVE,a3_0.ID,case when a3_1.ID is not null then 1 when a3_2.ID is not null then 2 when a3_3.ID is not null then 3 when a3_0.ID is not null then 0 end,a3_0.ACTIVE,a3_0.BUILDING,a3_0.CITY,a3_0.COUNTRY,a3_0.CREATE_TIMESTAMP,a3_0.DETAILS,a3_0.ENTITY_VERSION,a3_0.NUMBER,a3_0.POSTAL_CODE,a3_0.REGION,a3_0.STREET_NAME,a3_0.UID,a3_0.UPDATE_TIMESTAMP,so1_0.CREATE_TIMESTAMP,so1_0.DATE,so1_0.DELIVERY_ID,so1_0.ENTITY_VERSION,so1_0.LOCATION_ID,so1_0.UCR,so1_0.UID,so1_0.UPDATE_TIMESTAMP,so1_0.WAREHOUSE_ID,ir1_3.SOURCE_ID,s1_0.ID,case when s1_1.ID is not null then 1 when s1_2.ID is not null then 2 when s1_3.ID is not null then 3 when s1_0.ID is not null then 0 end,s1_0.ACTIVE,ba3_0.ID,case when ba3_1.ID is not null then 1 when ba3_2.ID is not null then 2 when ba3_3.ID is not null then 3 when ba3_0.ID is not null then 0 end,ba3_0.ACTIVE,ba3_0.BUILDING,ba3_0.CITY,ba3_0.COUNTRY,ba3_0.CREATE_TIMESTAMP,ba3_0.DETAILS,ba3_0.ENTITY_VERSION,ba3_0.NUMBER,ba3_0.POSTAL_CODE,ba3_0.REGION,ba3_0.STREET_NAME,ba3_0.UID,ba3_0.UPDATE_TIMESTAMP,s1_0.CREATE_TIMESTAMP,s1_0.ENTITY_VERSION,ma2_0.ID,case when ma2_1.ID is not null then 1 when ma2_2.ID is not null then 2 when ma2_3.ID is not null then 3 when ma2_0.ID is not null then 0 end,ma2_0.ACTIVE,ma2_0.BUILDING,ma2_0.CITY,ma2_0.COUNTRY,ma2_0.CREATE_TIMESTAMP,ma2_0.DETAILS,ma2_0.ENTITY_VERSION,ma2_0.NUMBER,ma2_0.POSTAL_CODE,ma2_0.REGION,ma2_0.STREET_NAME,ma2_0.UID,ma2_0.UPDATE_TIMESTAMP,mc3_0.ID,case when mc3_1.ID is not null then 1 when mc3_2.ID is not null then 2 when mc3_3.ID is not null then 3 when mc3_0.ID is not null then 0 end,mc3_0.ACTIVE,mc3_0.CREATE_TIMESTAMP,mc3_0.EMAIL,mc3_0.ENTITY_VERSION,mc3_0.FAX,mc3_0.MOBILE,mc3_0.NAME,mc3_0.PHONE,mc3_0.UID,mc3_0.UPDATE_TIMESTAMP,mc3_0.WEBSITE,s1_0.NAME,s1_0.SELF_BILLING_AGREEMENT,sa3_0.ID,case when sa3_1.ID is not null then 1 when sa3_2.ID is not null then 2 when sa3_3.ID is not null then 3 when sa3_0.ID is not null then 0 end,sa3_0.ACTIVE,sa3_0.BUILDING,sa3_0.CITY,sa3_0.COUNTRY,sa3_0.CREATE_TIMESTAMP,sa3_0.DETAILS,sa3_0.ENTITY_VERSION,sa3_0.NUMBER,sa3_0.POSTAL_CODE,sa3_0.REGION,sa3_0.STREET_NAME,sa3_0.UID,sa3_0.UPDATE_TIMESTAMP,s1_0.TAX_ID,s1_0.TAX_ID_COUNTRY,s1_0.UID,s1_0.UPDATE_TIMESTAMP,s1_2.REFERRAL_NAME,s1_1.REFERRAL_NAME,s1_3.REFERRAL_NAME,ir1_3.TAX_AMOUNT,ir1_3.THIRD_PARTY_BILLED,ir1_3.TRANSACTION_ID,ir1_3.UID,ir1_3.UPDATE_TIMESTAMP,ir1_2.BILLED,ir1_2.CANCELLED,ir1_2.EAC_CODE,ir1_1.CLIENT_TYPE,ir1_3.ID,e1_4.REASON,e1_7.REASON,rr1_0.ID,rr1_1.ACTIVE,rr1_1.AMOUNT_WITH_TAX,rr1_1.AMOUNT_WITHOUT_TAX,rr1_1.BATCH_ID,b2_0.ID,case when b2_1.ID is not null then 1 when b2_2.ID is not null then 2 when b2_3.ID is not null then 3 when b2_0.ID is not null then 0 end,b2_0.ACTIVE,a4_0.ID,case when a4_1.ID is not null then 1 when a4_2.ID is not null then 2 when a4_3.ID is not null then 3 when a4_0.ID is not null then 0 end,a4_0.ACTIVE,a4_0.BUILDING,a4_0.CITY,a4_0.COUNTRY,a4_0.CREATE_TIMESTAMP,a4_0.DETAILS,a4_0.ENTITY_VERSION,a4_0.NUMBER,a4_0.POSTAL_CODE,a4_0.REGION,a4_0.STREET_NAME,a4_0.UID,a4_0.UPDATE_TIMESTAMP,ba4_0.ID,case when ba4_1.ID is not null then 1 when ba4_2.ID is not null then 2 when ba4_3.ID is not null then 3 when ba4_0.ID is not null then 0 end,ba4_0.ACTIVE,ba4_0.BUILDING,ba4_0.CITY,ba4_0.COUNTRY,ba4_0.CREATE_TIMESTAMP,ba4_0.DETAILS,ba4_0.ENTITY_VERSION,ba4_0.NUMBER,ba4_0.POSTAL_CODE,ba4_0.REGION,ba4_0.STREET_NAME,ba4_0.UID,ba4_0.UPDATE_TIMESTAMP,b2_0.COMMERCIAL_NAME,b2_0.CREATE_TIMESTAMP,b2_0.ENTITY_VERSION,mc4_0.ID,case when mc4_1.ID is not null then 1 when mc4_2.ID is not null then 2 when mc4_3.ID is not null then 3 when mc4_0.ID is not null then 0 end,mc4_0.ACTIVE,mc4_0.CREATE_TIMESTAMP,mc4_0.EMAIL,mc4_0.ENTITY_VERSION,mc4_0.FAX,mc4_0.MOBILE,mc4_0.NAME,mc4_0.PHONE,mc4_0.UID,mc4_0.UPDATE_TIMESTAMP,mc4_0.WEBSITE,b2_0.NAME,oc2_0.ID,case when oc2_1.ID is not null then 1 when oc2_2.ID is not null then 2 when oc2_3.ID is not null then 3 when oc2_0.ID is not null then 0 end,oc2_0.ACTIVE,oc2_0.CREATE_TIMESTAMP,oc2_0.DESCRIPTION,oc2_0.ENTITY_VERSION,oc2_0.NAME,p4_0.ID,case when p4_1.ID is not null then 1 when p4_2.ID is not null then 2 when p4_3.ID is not null then 3 when p4_0.ID is not null then 0 end,p4_0.ACTIVE,p4_0.CREATE_TIMESTAMP,p4_0.DESCRIPTION,p4_0.ENTITY_VERSION,p4_0.NAME,p4_0.ID_CONTEXT_PARENT,p4_0.UID,p4_0.UPDATE_TIMESTAMP,p4_1.REGION_CODE,oc2_0.UID,oc2_0.UPDATE_TIMESTAMP,oc2_1.REGION_CODE,sa4_0.ID,case when sa4_1.ID is not null then 1 when sa4_2.ID is not null then 2 when sa4_3.ID is not null then 3 when sa4_0.ID is not null then 0 end,sa4_0.ACTIVE,sa4_0.BUILDING,sa4_0.CITY,sa4_0.COUNTRY,sa4_0.CREATE_TIMESTAMP,sa4_0.DETAILS,sa4_0.ENTITY_VERSION,sa4_0.NUMBER,sa4_0.POSTAL_CODE,sa4_0.REGION,sa4_0.STREET_NAME,sa4_0.UID,sa4_0.UPDATE_TIMESTAMP,b2_0.TAX_ID,b2_0.TAX_ID_COUNTRY,b2_0.timezone,b2_0.UID,b2_0.UPDATE_TIMESTAMP,b2_0.WEBSITE,rr1_1.CASH_VAT_ENDORSER,rr1_1.CREATE_TIMESTAMP,rr1_1.CREDIT_OR_DEBIT,rr1_1.CURRENCY,c2_0.ID,case when c2_1.ID is not null then 1 when c2_2.ID is not null then 2 when c2_3.ID is not null then 3 when c2_0.ID is not null then 0 end,c2_0.ACTIVE,ba5_0.ID,case when ba5_1.ID is not null then 1 when ba5_2.ID is not null then 2 when ba5_3.ID is not null then 3 when ba5_0.ID is not null then 0 end,ba5_0.ACTIVE,ba5_0.BUILDING,ba5_0.CITY,ba5_0.COUNTRY,ba5_0.CREATE_TIMESTAMP,ba5_0.DETAILS,ba5_0.ENTITY_VERSION,ba5_0.NUMBER,ba5_0.POSTAL_CODE,ba5_0.REGION,ba5_0.STREET_NAME,ba5_0.UID,ba5_0.UPDATE_TIMESTAMP,c2_0.CREATE_TIMESTAMP,c2_0.ENTITY_VERSION,ma3_0.ID,case when ma3_1.ID is not null then 1 when ma3_2.ID is not null then 2 when ma3_3.ID is not null then 3 when ma3_0.ID is not null then 0 end,ma3_0.ACTIVE,ma3_0.BUILDING,ma3_0.CITY,ma3_0.COUNTRY,ma3_0.CREATE_TIMESTAMP,ma3_0.DETAILS,ma3_0.ENTITY_VERSION,ma3_0.NUMBER,ma3_0.POSTAL_CODE,ma3_0.REGION,ma3_0.STREET_NAME,ma3_0.UID,ma3_0.UPDATE_TIMESTAMP,mc5_0.ID,case when mc5_1.ID is not null then 1 when mc5_2.ID is not null then 2 when mc5_3.ID is not null then 3 when mc5_0.ID is not null then 0 end,mc5_0.ACTIVE,mc5_0.CREATE_TIMESTAMP,mc5_0.EMAIL,mc5_0.ENTITY_VERSION,mc5_0.FAX,mc5_0.MOBILE,mc5_0.NAME,mc5_0.PHONE,mc5_0.UID,mc5_0.UPDATE_TIMESTAMP,mc5_0.WEBSITE,c2_0.NAME,c2_0.SELF_BILLING,sa5_0.ID,case when sa5_1.ID is not null then 1 when sa5_2.ID is not null then 2 when sa5_3.ID is not null then 3 when sa5_0.ID is not null then 0 end,sa5_0.ACTIVE,sa5_0.BUILDING,sa5_0.CITY,sa5_0.COUNTRY,sa5_0.CREATE_TIMESTAMP,sa5_0.DETAILS,sa5_0.ENTITY_VERSION,sa5_0.NUMBER,sa5_0.POSTAL_CODE,sa5_0.REGION,sa5_0.STREET_NAME,sa5_0.UID,sa5_0.UPDATE_TIMESTAMP,c2_0.TAX_ID,c2_0.TAX_ID_COUNTRY,c2_0.UID,c2_0.UPDATE_TIMESTAMP,c2_2.REFERRAL_NAME,c2_1.REFERRAL_NAME,c2_3.REFERRAL_NAME,rr1_1.DATE,rr1_1.DISCOUNTS_AMOUNT,rr1_1.ENTITY_VERSION,rr1_1.GENERAL_LEDGER_DATE,rr1_1.LOCAL_DATE,rr1_1.NUMBER,rr1_1.OFFICE_NUMBER,rr1_1.PAYMENT_TERMS,rr1_1.SCALE,rr1_1.SELF_BILLED,rr1_1.SERIES,rr1_1.SERIES_NUMBER,rr1_1.SETTLEMENT_DATE,rr1_1.SETTLEMENT_DESCRIPTION,rr1_1.SETTLEMENT_DISCOUNT,sd2_0.ID,case when sd2_1.ID is not null then 1 when sd2_2.ID is not null then 2 when sd2_3.ID is not null then 3 when sd2_0.ID is not null then 0 end,sd2_0.ACTIVE,a5_0.ID,case when a5_1.ID is not null then 1 when a5_2.ID is not null then 2 when a5_3.ID is not null then 3 when a5_0.ID is not null then 0 end,a5_0.ACTIVE,a5_0.BUILDING,a5_0.CITY,a5_0.COUNTRY,a5_0.CREATE_TIMESTAMP,a5_0.DETAILS,a5_0.ENTITY_VERSION,a5_0.NUMBER,a5_0.POSTAL_CODE,a5_0.REGION,a5_0.STREET_NAME,a5_0.UID,a5_0.UPDATE_TIMESTAMP,sd2_0.CREATE_TIMESTAMP,sd2_0.DATE,sd2_0.DELIVERY_ID,sd2_0.ENTITY_VERSION,sd2_0.LOCATION_ID,sd2_0.UCR,sd2_0.UID,sd2_0.UPDATE_TIMESTAMP,sd2_0.WAREHOUSE_ID,so2_0.ID,case when so2_1.ID is not null then 1 when so2_2.ID is not null then 2 when so2_3.ID is not null then 3 when so2_0.ID is not null then 0 end,so2_0.ACTIVE,a6_0.ID,case when a6_1.ID is not null then 1 when a6_2.ID is not null then 2 when a6_3.ID is not null then 3 when a6_0.ID is not null then 0 end,a6_0.ACTIVE,a6_0.BUILDING,a6_0.CITY,a6_0.COUNTRY,a6_0.CREATE_TIMESTAMP,a6_0.DETAILS,a6_0.ENTITY_VERSION,a6_0.NUMBER,a6_0.POSTAL_CODE,a6_0.REGION,a6_0.STREET_NAME,a6_0.UID,a6_0.UPDATE_TIMESTAMP,so2_0.CREATE_TIMESTAMP,so2_0.DATE,so2_0.DELIVERY_ID,so2_0.ENTITY_VERSION,so2_0.LOCATION_ID,so2_0.UCR,so2_0.UID,so2_0.UPDATE_TIMESTAMP,so2_0.WAREHOUSE_ID,rr1_1.SOURCE_ID,s2_0.ID,case when s2_1.ID is not null then 1 when s2_2.ID is not null then 2 when s2_3.ID is not null then 3 when s2_0.ID is not null then 0 end,s2_0.ACTIVE,ba6_0.ID,case when ba6_1.ID is not null then 1 when ba6_2.ID is not null then 2 when ba6_3.ID is not null then 3 when ba6_0.ID is not null then 0 end,ba6_0.ACTIVE,ba6_0.BUILDING,ba6_0.CITY,ba6_0.COUNTRY,ba6_0.CREATE_TIMESTAMP,ba6_0.DETAILS,ba6_0.ENTITY_VERSION,ba6_0.NUMBER,ba6_0.POSTAL_CODE,ba6_0.REGION,ba6_0.STREET_NAME,ba6_0.UID,ba6_0.UPDATE_TIMESTAMP,s2_0.CREATE_TIMESTAMP,s2_0.ENTITY_VERSION,ma4_0.ID,case when ma4_1.ID is not null then 1 when ma4_2.ID is not null then 2 when ma4_3.ID is not null then 3 when ma4_0.ID is not null then 0 end,ma4_0.ACTIVE,ma4_0.BUILDING,ma4_0.CITY,ma4_0.COUNTRY,ma4_0.CREATE_TIMESTAMP,ma4_0.DETAILS,ma4_0.ENTITY_VERSION,ma4_0.NUMBER,ma4_0.POSTAL_CODE,ma4_0.REGION,ma4_0.STREET_NAME,ma4_0.UID,ma4_0.UPDATE_TIMESTAMP,mc6_0.ID,case when mc6_1.ID is not null then 1 when mc6_2.ID is not null then 2 when mc6_3.ID is not null then 3 when mc6_0.ID is not null then 0 end,mc6_0.ACTIVE,mc6_0.CREATE_TIMESTAMP,mc6_0.EMAIL,mc6_0.ENTITY_VERSION,mc6_0.FAX,mc6_0.MOBILE,mc6_0.NAME,mc6_0.PHONE,mc6_0.UID,mc6_0.UPDATE_TIMESTAMP,mc6_0.WEBSITE,s2_0.NAME,s2_0.SELF_BILLING_AGREEMENT,sa6_0.ID,case when sa6_1.ID is not null then 1 when sa6_2.ID is not null then 2 when sa6_3.ID is not null then 3 when sa6_0.ID is not null then 0 end,sa6_0.ACTIVE,sa6_0.BUILDING,sa6_0.CITY,sa6_0.COUNTRY,sa6_0.CREATE_TIMESTAMP,sa6_0.DETAILS,sa6_0.ENTITY_VERSION,sa6_0.NUMBER,sa6_0.POSTAL_CODE,sa6_0.REGION,sa6_0.STREET_NAME,sa6_0.UID,sa6_0.UPDATE_TIMESTAMP,s2_0.TAX_ID,s2_0.TAX_ID_COUNTRY,s2_0.UID,s2_0.UPDATE_TIMESTAMP,s2_2.REFERRAL_NAME,s2_1.REFERRAL_NAME,s2_3.REFERRAL_NAME,rr1_1.TAX_AMOUNT,rr1_1.THIRD_PARTY_BILLED,rr1_1.TRANSACTION_ID,rr1_1.UID,rr1_1.UPDATE_TIMESTAMP,rr1_2.BILLED,rr1_2.CANCELLED,rr1_2.EAC_CODE,rr1_1.ID,e1_2.REASON,r1_0.ID,case when r1_1.ID is not null then 4 when r1_2.ID is not null then 5 when r1_0.ID is not null then 3 when r1_3.ID is not null then 1 when r1_4.ID is not null then 0 end,r1_4.ACTIVE,r1_4.AMOUNT_WITH_TAX,r1_4.AMOUNT_WITHOUT_TAX,r1_4.BATCH_ID,b3_0.ID,case when b3_1.ID is not null then 1 when b3_2.ID is not null then 2 when b3_3.ID is not null then 3 when b3_0.ID is not null then 0 end,b3_0.ACTIVE,a7_0.ID,case when a7_1.ID is not null then 1 when a7_2.ID is not null then 2 when a7_3.ID is not null then 3 when a7_0.ID is not null then 0 end,a7_0.ACTIVE,a7_0.BUILDING,a7_0.CITY,a7_0.COUNTRY,a7_0.CREATE_TIMESTAMP,a7_0.DETAILS,a7_0.ENTITY_VERSION,a7_0.NUMBER,a7_0.POSTAL_CODE,a7_0.REGION,a7_0.STREET_NAME,a7_0.UID,a7_0.UPDATE_TIMESTAMP,ba7_0.ID,case when ba7_1.ID is not null then 1 when ba7_2.ID is not null then 2 when ba7_3.ID is not null then 3 when ba7_0.ID is not null then 0 end,ba7_0.ACTIVE,ba7_0.BUILDING,ba7_0.CITY,ba7_0.COUNTRY,ba7_0.CREATE_TIMESTAMP,ba7_0.DETAILS,ba7_0.ENTITY_VERSION,ba7_0.NUMBER,ba7_0.POSTAL_CODE,ba7_0.REGION,ba7_0.STREET_NAME,ba7_0.UID,ba7_0.UPDATE_TIMESTAMP,b3_0.COMMERCIAL_NAME,b3_0.CREATE_TIMESTAMP,b3_0.ENTITY_VERSION,mc7_0.ID,case when mc7_1.ID is not null then 1 when mc7_2.ID is not null then 2 when mc7_3.ID is not null then 3 when mc7_0.ID is not null then 0 end,mc7_0.ACTIVE,mc7_0.CREATE_TIMESTAMP,mc7_0.EMAIL,mc7_0.ENTITY_VERSION,mc7_0.FAX,mc7_0.MOBILE,mc7_0.NAME,mc7_0.PHONE,mc7_0.UID,mc7_0.UPDATE_TIMESTAMP,mc7_0.WEBSITE,b3_0.NAME,oc3_0.ID,case when oc3_1.ID is not null then 1 when oc3_2.ID is not null then 2 when oc3_3.ID is not null then 3 when oc3_0.ID is not null then 0 end,oc3_0.ACTIVE,oc3_0.CREATE_TIMESTAMP,oc3_0.DESCRIPTION,oc3_0.ENTITY_VERSION,oc3_0.NAME,p6_0.ID,case when p6_1.ID is not null then 1 when p6_2.ID is not null then 2 when p6_3.ID is not null then 3 when p6_0.ID is not null then 0 end,p6_0.ACTIVE,p6_0.CREATE_TIMESTAMP,p6_0.DESCRIPTION,p6_0.ENTITY_VERSION,p6_0.NAME,p6_0.ID_CONTEXT_PARENT,p6_0.UID,p6_0.UPDATE_TIMESTAMP,p6_1.REGION_CODE,oc3_0.UID,oc3_0.UPDATE_TIMESTAMP,oc3_1.REGION_CODE,sa7_0.ID,case when sa7_1.ID is not null then 1 when sa7_2.ID is not null then 2 when sa7_3.ID is not null then 3 when sa7_0.ID is not null then 0 end,sa7_0.ACTIVE,sa7_0.BUILDING,sa7_0.CITY,sa7_0.COUNTRY,sa7_0.CREATE_TIMESTAMP,sa7_0.DETAILS,sa7_0.ENTITY_VERSION,sa7_0.NUMBER,sa7_0.POSTAL_CODE,sa7_0.REGION,sa7_0.STREET_NAME,sa7_0.UID,sa7_0.UPDATE_TIMESTAMP,b3_0.TAX_ID,b3_0.TAX_ID_COUNTRY,b3_0.timezone,b3_0.UID,b3_0.UPDATE_TIMESTAMP,b3_0.WEBSITE,r1_4.CASH_VAT_ENDORSER,r1_4.CREATE_TIMESTAMP,r1_4.CREDIT_OR_DEBIT,r1_4.CURRENCY,c3_0.ID,case when c3_1.ID is not null then 1 when c3_2.ID is not null then 2 when c3_3.ID is not null then 3 when c3_0.ID is not null then 0 end,c3_0.ACTIVE,ba8_0.ID,case when ba8_1.ID is not null then 1 when ba8_2.ID is not null then 2 when ba8_3.ID is not null then 3 when ba8_0.ID is not null then 0 end,ba8_0.ACTIVE,ba8_0.BUILDING,ba8_0.CITY,ba8_0.COUNTRY,ba8_0.CREATE_TIMESTAMP,ba8_0.DETAILS,ba8_0.ENTITY_VERSION,ba8_0.NUMBER,ba8_0.POSTAL_CODE,ba8_0.REGION,ba8_0.STREET_NAME,ba8_0.UID,ba8_0.UPDATE_TIMESTAMP,c3_0.CREATE_TIMESTAMP,c3_0.ENTITY_VERSION,ma5_0.ID,case when ma5_1.ID is not null then 1 when ma5_2.ID is not null then 2 when ma5_3.ID is not null then 3 when ma5_0.ID is not null then 0 end,ma5_0.ACTIVE,ma5_0.BUILDING,ma5_0.CITY,ma5_0.COUNTRY,ma5_0.CREATE_TIMESTAMP,ma5_0.DETAILS,ma5_0.ENTITY_VERSION,ma5_0.NUMBER,ma5_0.POSTAL_CODE,ma5_0.REGION,ma5_0.STREET_NAME,ma5_0.UID,ma5_0.UPDATE_TIMESTAMP,mc8_0.ID,case when mc8_1.ID is not null then 1 when mc8_2.ID is not null then 2 when mc8_3.ID is not null then 3 when mc8_0.ID is not null then 0 end,mc8_0.ACTIVE,mc8_0.CREATE_TIMESTAMP,mc8_0.EMAIL,mc8_0.ENTITY_VERSION,mc8_0.FAX,mc8_0.MOBILE,mc8_0.NAME,mc8_0.PHONE,mc8_0.UID,mc8_0.UPDATE_TIMESTAMP,mc8_0.WEBSITE,c3_0.NAME,c3_0.SELF_BILLING,sa8_0.ID,case when sa8_1.ID is not null then 1 when sa8_2.ID is not null then 2 when sa8_3.ID is not null then 3 when sa8_0.ID is not null then 0 end,sa8_0.ACTIVE,sa8_0.BUILDING,sa8_0.CITY,sa8_0.COUNTRY,sa8_0.CREATE_TIMESTAMP,sa8_0.DETAILS,sa8_0.ENTITY_VERSION,sa8_0.NUMBER,sa8_0.POSTAL_CODE,sa8_0.REGION,sa8_0.STREET_NAME,sa8_0.UID,sa8_0.UPDATE_TIMESTAMP,c3_0.TAX_ID,c3_0.TAX_ID_COUNTRY,c3_0.UID,c3_0.UPDATE_TIMESTAMP,c3_2.REFERRAL_NAME,c3_1.REFERRAL_NAME,c3_3.REFERRAL_NAME,r1_4.DATE,r1_4.DISCOUNTS_AMOUNT,r1_4.ENTITY_VERSION,r1_4.GENERAL_LEDGER_DATE,r1_4.LOCAL_DATE,r1_4.NUMBER,r1_4.OFFICE_NUMBER,r1_4.PAYMENT_TERMS,r1_4.SCALE,r1_4.SELF_BILLED,r1_4.SERIES,r1_4.SERIES_NUMBER,r1_4.SETTLEMENT_DATE,r1_4.SETTLEMENT_DESCRIPTION,r1_4.SETTLEMENT_DISCOUNT,sd3_0.ID,case when sd3_1.ID is not null then 1 when sd3_2.ID is not null then 2 when sd3_3.ID is not null then 3 when sd3_0.ID is not null then 0 end,sd3_0.ACTIVE,a8_0.ID,case when a8_1.ID is not null then 1 when a8_2.ID is not null then 2 when a8_3.ID is not null then 3 when a8_0.ID is not null then 0 end,a8_0.ACTIVE,a8_0.BUILDING,a8_0.CITY,a8_0.COUNTRY,a8_0.CREATE_TIMESTAMP,a8_0.DETAILS,a8_0.ENTITY_VERSION,a8_0.NUMBER,a8_0.POSTAL_CODE,a8_0.REGION,a8_0.STREET_NAME,a8_0.UID,a8_0.UPDATE_TIMESTAMP,sd3_0.CREATE_TIMESTAMP,sd3_0.DATE,sd3_0.DELIVERY_ID,sd3_0.ENTITY_VERSION,sd3_0.LOCATION_ID,sd3_0.UCR,sd3_0.UID,sd3_0.UPDATE_TIMESTAMP,sd3_0.WAREHOUSE_ID,so3_0.ID,case when so3_1.ID is not null then 1 when so3_2.ID is not null then 2 when so3_3.ID is not null then 3 when so3_0.ID is not null then 0 end,so3_0.ACTIVE,a9_0.ID,case when a9_1.ID is not null then 1 when a9_2.ID is not null then 2 when a9_3.ID is not null then 3 when a9_0.ID is not null then 0 end,a9_0.ACTIVE,a9_0.BUILDING,a9_0.CITY,a9_0.COUNTRY,a9_0.CREATE_TIMESTAMP,a9_0.DETAILS,a9_0.ENTITY_VERSION,a9_0.NUMBER,a9_0.POSTAL_CODE,a9_0.REGION,a9_0.STREET_NAME,a9_0.UID,a9_0.UPDATE_TIMESTAMP,so3_0.CREATE_TIMESTAMP,so3_0.DATE,so3_0.DELIVERY_ID,so3_0.ENTITY_VERSION,so3_0.LOCATION_ID,so3_0.UCR,so3_0.UID,so3_0.UPDATE_TIMESTAMP,so3_0.WAREHOUSE_ID,r1_4.SOURCE_ID,s3_0.ID,case when s3_1.ID is not null then 1 when s3_2.ID is not null then 2 when s3_3.ID is not null then 3 when s3_0.ID is not null then 0 end,s3_0.ACTIVE,ba9_0.ID,case when ba9_1.ID is not null then 1 when ba9_2.ID is not null then 2 when ba9_3.ID is not null then 3 when ba9_0.ID is not null then 0 end,ba9_0.ACTIVE,ba9_0.BUILDING,ba9_0.CITY,ba9_0.COUNTRY,ba9_0.CREATE_TIMESTAMP,ba9_0.DETAILS,ba9_0.ENTITY_VERSION,ba9_0.NUMBER,ba9_0.POSTAL_CODE,ba9_0.REGION,ba9_0.STREET_NAME,ba9_0.UID,ba9_0.UPDATE_TIMESTAMP,s3_0.CREATE_TIMESTAMP,s3_0.ENTITY_VERSION,ma6_0.ID,case when ma6_1.ID is not null then 1 when ma6_2.ID is not null then 2 when ma6_3.ID is not null then 3 when ma6_0.ID is not null then 0 end,ma6_0.ACTIVE,ma6_0.BUILDING,ma6_0.CITY,ma6_0.COUNTRY,ma6_0.CREATE_TIMESTAMP,ma6_0.DETAILS,ma6_0.ENTITY_VERSION,ma6_0.NUMBER,ma6_0.POSTAL_CODE,ma6_0.REGION,ma6_0.STREET_NAME,ma6_0.UID,ma6_0.UPDATE_TIMESTAMP,mc9_0.ID,case when mc9_1.ID is not null then 1 when mc9_2.ID is not null then 2 when mc9_3.ID is not null then 3 when mc9_0.ID is not null then 0 end,mc9_0.ACTIVE,mc9_0.CREATE_TIMESTAMP,mc9_0.EMAIL,mc9_0.ENTITY_VERSION,mc9_0.FAX,mc9_0.MOBILE,mc9_0.NAME,mc9_0.PHONE,mc9_0.UID,mc9_0.UPDATE_TIMESTAMP,mc9_0.WEBSITE,s3_0.NAME,s3_0.SELF_BILLING_AGREEMENT,sa9_0.ID,case when sa9_1.ID is not null then 1 when sa9_2.ID is not null then 2 when sa9_3.ID is not null then 3 when sa9_0.ID is not null then 0 end,sa9_0.ACTIVE,sa9_0.BUILDING,sa9_0.CITY,sa9_0.COUNTRY,sa9_0.CREATE_TIMESTAMP,sa9_0.DETAILS,sa9_0.ENTITY_VERSION,sa9_0.NUMBER,sa9_0.POSTAL_CODE,sa9_0.REGION,sa9_0.STREET_NAME,sa9_0.UID,sa9_0.UPDATE_TIMESTAMP,s3_0.TAX_ID,s3_0.TAX_ID_COUNTRY,s3_0.UID,s3_0.UPDATE_TIMESTAMP,s3_2.REFERRAL_NAME,s3_1.REFERRAL_NAME,s3_3.REFERRAL_NAME,r1_4.TAX_AMOUNT,r1_4.THIRD_PARTY_BILLED,r1_4.TRANSACTION_ID,r1_4.UID,r1_4.UPDATE_TIMESTAMP,r1_3.ATCUD,r1_3.BILLED,r1_3.CANCELLED,r1_3.EAC_CODE,r1_3.HASH,r1_3.HASH_CONTROL,r1_3.CHANGE_REASON,r1_3.SOURCE_BILLING,r1_3.SOURCE_HASH,r1_3.INVOICE_TYPE,r1_1.CLIENT_TYPE,r1_4.ID,ir2_0.ID,case when ir2_1.ID is not null then 15 when ir2_0.ID is not null then 14 when ir2_2.ID is not null then 12 when ir2_3.ID is not null then 0 end,ir2_3.ACTIVE,ir2_3.AMOUNT_WITH_TAX,ir2_3.AMOUNT_WITHOUT_TAX,ir2_3.BATCH_ID,b4_0.ID,case when b4_1.ID is not null then 1 when b4_2.ID is not null then 2 when b4_3.ID is not null then 3 when b4_0.ID is not null then 0 end,b4_0.ACTIVE,a10_0.ID,case when a10_1.ID is not null then 1 when a10_2.ID is not null then 2 when a10_3.ID is not null then 3 when a10_0.ID is not null then 0 end,a10_0.ACTIVE,a10_0.BUILDING,a10_0.CITY,a10_0.COUNTRY,a10_0.CREATE_TIMESTAMP,a10_0.DETAILS,a10_0.ENTITY_VERSION,a10_0.NUMBER,a10_0.POSTAL_CODE,a10_0.REGION,a10_0.STREET_NAME,a10_0.UID,a10_0.UPDATE_TIMESTAMP,ba10_0.ID,case when ba10_1.ID is not null then 1 when ba10_2.ID is not null then 2 when ba10_3.ID is not null then 3 when ba10_0.ID is not null then 0 end,ba10_0.ACTIVE,ba10_0.BUILDING,ba10_0.CITY,ba10_0.COUNTRY,ba10_0.CREATE_TIMESTAMP,ba10_0.DETAILS,ba10_0.ENTITY_VERSION,ba10_0.NUMBER,ba10_0.POSTAL_CODE,ba10_0.REGION,ba10_0.STREET_NAME,ba10_0.UID,ba10_0.UPDATE_TIMESTAMP,b4_0.COMMERCIAL_NAME,b4_0.CREATE_TIMESTAMP,b4_0.ENTITY_VERSION,mc10_0.ID,case when mc10_1.ID is not null then 1 when mc10_2.ID is not null then 2 when mc10_3.ID is not null then 3 when mc10_0.ID is not null then 0 end,mc10_0.ACTIVE,mc10_0.CREATE_TIMESTAMP,mc10_0.EMAIL,mc10_0.ENTITY_VERSION,mc10_0.FAX,mc10_0.MOBILE,mc10_0.NAME,mc10_0.PHONE,mc10_0.UID,mc10_0.UPDATE_TIMESTAMP,mc10_0.WEBSITE,b4_0.NAME,oc4_0.ID,case when oc4_1.ID is not null then 1 when oc4_2.ID is not null then 2 when oc4_3.ID is not null then 3 when oc4_0.ID is not null then 0 end,oc4_0.ACTIVE,oc4_0.CREATE_TIMESTAMP,oc4_0.DESCRIPTION,oc4_0.ENTITY_VERSION,oc4_0.NAME,p8_0.ID,case when p8_1.ID is not null then 1 when p8_2.ID is not null then 2 when p8_3.ID is not null then 3 when p8_0.ID is not null then 0 end,p8_0.ACTIVE,p8_0.CREATE_TIMESTAMP,p8_0.DESCRIPTION,p8_0.ENTITY_VERSION,p8_0.NAME,p8_0.ID_CONTEXT_PARENT,p8_0.UID,p8_0.UPDATE_TIMESTAMP,p8_1.REGION_CODE,oc4_0.UID,oc4_0.UPDATE_TIMESTAMP,oc4_1.REGION_CODE,sa10_0.ID,case when sa10_1.ID is not null then 1 when sa10_2.ID is not null then 2 when sa10_3.ID is not null then 3 when sa10_0.ID is not null then 0 end,sa10_0.ACTIVE,sa10_0.BUILDING,sa10_0.CITY,sa10_0.COUNTRY,sa10_0.CREATE_TIMESTAMP,sa10_0.DETAILS,sa10_0.ENTITY_VERSION,sa10_0.NUMBER,sa10_0.POSTAL_CODE,sa10_0.REGION,sa10_0.STREET_NAME,sa10_0.UID,sa10_0.UPDATE_TIMESTAMP,b4_0.TAX_ID,b4_0.TAX_ID_COUNTRY,b4_0.timezone,b4_0.UID,b4_0.UPDATE_TIMESTAMP,b4_0.WEBSITE,ir2_3.CASH_VAT_ENDORSER,ir2_3.CREATE_TIMESTAMP,ir2_3.CREDIT_OR_DEBIT,ir2_3.CURRENCY,c4_0.ID,case when c4_1.ID is not null then 1 when c4_2.ID is not null then 2 when c4_3.ID is not null then 3 when c4_0.ID is not null then 0 end,c4_0.ACTIVE,ba11_0.ID,case when ba11_1.ID is not null then 1 when ba11_2.ID is not null then 2 when ba11_3.ID is not null then 3 when ba11_0.ID is not null then 0 end,ba11_0.ACTIVE,ba11_0.BUILDING,ba11_0.CITY,ba11_0.COUNTRY,ba11_0.CREATE_TIMESTAMP,ba11_0.DETAILS,ba11_0.ENTITY_VERSION,ba11_0.NUMBER,ba11_0.POSTAL_CODE,ba11_0.REGION,ba11_0.STREET_NAME,ba11_0.UID,ba11_0.UPDATE_TIMESTAMP,c4_0.CREATE_TIMESTAMP,c4_0.ENTITY_VERSION,ma7_0.ID,case when ma7_1.ID is not null then 1 when ma7_2.ID is not null then 2 when ma7_3.ID is not null then 3 when ma7_0.ID is not null then 0 end,ma7_0.ACTIVE,ma7_0.BUILDING,ma7_0.CITY,ma7_0.COUNTRY,ma7_0.CREATE_TIMESTAMP,ma7_0.DETAILS,ma7_0.ENTITY_VERSION,ma7_0.NUMBER,ma7_0.POSTAL_CODE,ma7_0.REGION,ma7_0.STREET_NAME,ma7_0.UID,ma7_0.UPDATE_TIMESTAMP,mc11_0.ID,case when mc11_1.ID is not null then 1 when mc11_2.ID is not null then 2 when mc11_3.ID is not null then 3 when mc11_0.ID is not null then 0 end,mc11_0.ACTIVE,mc11_0.CREATE_TIMESTAMP,mc11_0.EMAIL,mc11_0.ENTITY_VERSION,mc11_0.FAX,mc11_0.MOBILE,mc11_0.NAME,mc11_0.PHONE,mc11_0.UID,mc11_0.UPDATE_TIMESTAMP,mc11_0.WEBSITE,c4_0.NAME,c4_0.SELF_BILLING,sa11_0.ID,case when sa11_1.ID is not null then 1 when sa11_2.ID is not null then 2 when sa11_3.ID is not null then 3 when sa11_0.ID is not null then 0 end,sa11_0.ACTIVE,sa11_0.BUILDING,sa11_0.CITY,sa11_0.COUNTRY,sa11_0.CREATE_TIMESTAMP,sa11_0.DETAILS,sa11_0.ENTITY_VERSION,sa11_0.NUMBER,sa11_0.POSTAL_CODE,sa11_0.REGION,sa11_0.STREET_NAME,sa11_0.UID,sa11_0.UPDATE_TIMESTAMP,c4_0.TAX_ID,c4_0.TAX_ID_COUNTRY,c4_0.UID,c4_0.UPDATE_TIMESTAMP,c4_2.REFERRAL_NAME,c4_1.REFERRAL_NAME,c4_3.REFERRAL_NAME,ir2_3.DATE,ir2_3.DISCOUNTS_AMOUNT,ir2_3.ENTITY_VERSION,ir2_3.GENERAL_LEDGER_DATE,ir2_3.LOCAL_DATE,ir2_3.NUMBER,ir2_3.OFFICE_NUMBER,ir2_3.PAYMENT_TERMS,ir2_3.SCALE,ir2_3.SELF_BILLED,ir2_3.SERIES,ir2_3.SERIES_NUMBER,ir2_3.SETTLEMENT_DATE,ir2_3.SETTLEMENT_DESCRIPTION,ir2_3.SETTLEMENT_DISCOUNT,sd4_0.ID,case when sd4_1.ID is not null then 1 when sd4_2.ID is not null then 2 when sd4_3.ID is not null then 3 when sd4_0.ID is not null then 0 end,sd4_0.ACTIVE,a11_0.ID,case when a11_1.ID is not null then 1 when a11_2.ID is not null then 2 when a11_3.ID is not null then 3 when a11_0.ID is not null then 0 end,a11_0.ACTIVE,a11_0.BUILDING,a11_0.CITY,a11_0.COUNTRY,a11_0.CREATE_TIMESTAMP,a11_0.DETAILS,a11_0.ENTITY_VERSION,a11_0.NUMBER,a11_0.POSTAL_CODE,a11_0.REGION,a11_0.STREET_NAME,a11_0.UID,a11_0.UPDATE_TIMESTAMP,sd4_0.CREATE_TIMESTAMP,sd4_0.DATE,sd4_0.DELIVERY_ID,sd4_0.ENTITY_VERSION,sd4_0.LOCATION_ID,sd4_0.UCR,sd4_0.UID,sd4_0.UPDATE_TIMESTAMP,sd4_0.WAREHOUSE_ID,so4_0.ID,case when so4_1.ID is not null then 1 when so4_2.ID is not null then 2 when so4_3.ID is not null then 3 when so4_0.ID is not null then 0 end,so4_0.ACTIVE,a12_0.ID,case when a12_1.ID is not null then 1 when a12_2.ID is not null then 2 when a12_3.ID is not null then 3 when a12_0.ID is not null then 0 end,a12_0.ACTIVE,a12_0.BUILDING,a12_0.CITY,a12_0.COUNTRY,a12_0.CREATE_TIMESTAMP,a12_0.DETAILS,a12_0.ENTITY_VERSION,a12_0.NUMBER,a12_0.POSTAL_CODE,a12_0.REGION,a12_0.STREET_NAME,a12_0.UID,a12_0.UPDATE_TIMESTAMP,so4_0.CREATE_TIMESTAMP,so4_0.DATE,so4_0.DELIVERY_ID,so4_0.ENTITY_VERSION,so4_0.LOCATION_ID,so4_0.UCR,so4_0.UID,so4_0.UPDATE_TIMESTAMP,so4_0.WAREHOUSE_ID,ir2_3.SOURCE_ID,s4_0.ID,case when s4_1.ID is not null then 1 when s4_2.ID is not null then 2 when s4_3.ID is not null then 3 when s4_0.ID is not null then 0 end,s4_0.ACTIVE,ba12_0.ID,case when ba12_1.ID is not null then 1 when ba12_2.ID is not null then 2 when ba12_3.ID is not null then 3 when ba12_0.ID is not null then 0 end,ba12_0.ACTIVE,ba12_0.BUILDING,ba12_0.CITY,ba12_0.COUNTRY,ba12_0.CREATE_TIMESTAMP,ba12_0.DETAILS,ba12_0.ENTITY_VERSION,ba12_0.NUMBER,ba12_0.POSTAL_CODE,ba12_0.REGION,ba12_0.STREET_NAME,ba12_0.UID,ba12_0.UPDATE_TIMESTAMP,s4_0.CREATE_TIMESTAMP,s4_0.ENTITY_VERSION,ma8_0.ID,case when ma8_1.ID is not null then 1 when ma8_2.ID is not null then 2 when ma8_3.ID is not null then 3 when ma8_0.ID is not null then 0 end,ma8_0.ACTIVE,ma8_0.BUILDING,ma8_0.CITY,ma8_0.COUNTRY,ma8_0.CREATE_TIMESTAMP,ma8_0.DETAILS,ma8_0.ENTITY_VERSION,ma8_0.NUMBER,ma8_0.POSTAL_CODE,ma8_0.REGION,ma8_0.STREET_NAME,ma8_0.UID,ma8_0.UPDATE_TIMESTAMP,mc12_0.ID,case when mc12_1.ID is not null then 1 when mc12_2.ID is not null then 2 when mc12_3.ID is not null then 3 when mc12_0.ID is not null then 0 end,mc12_0.ACTIVE,mc12_0.CREATE_TIMESTAMP,mc12_0.EMAIL,mc12_0.ENTITY_VERSION,mc12_0.FAX,mc12_0.MOBILE,mc12_0.NAME,mc12_0.PHONE,mc12_0.UID,mc12_0.UPDATE_TIMESTAMP,mc12_0.WEBSITE,s4_0.NAME,s4_0.SELF_BILLING_AGREEMENT,sa12_0.ID,case when sa12_1.ID is not null then 1 when sa12_2.ID is not null then 2 when sa12_3.ID is not null then 3 when sa12_0.ID is not null then 0 end,sa12_0.ACTIVE,sa12_0.BUILDING,sa12_0.CITY,sa12_0.COUNTRY,sa12_0.CREATE_TIMESTAMP,sa12_0.DETAILS,sa12_0.ENTITY_VERSION,sa12_0.NUMBER,sa12_0.POSTAL_CODE,sa12_0.REGION,sa12_0.STREET_NAME,sa12_0.UID,sa12_0.UPDATE_TIMESTAMP,s4_0.TAX_ID,s4_0.TAX_ID_COUNTRY,s4_0.UID,s4_0.UPDATE_TIMESTAMP,s4_2.REFERRAL_NAME,s4_1.REFERRAL_NAME,s4_3.REFERRAL_NAME,ir2_3.TAX_AMOUNT,ir2_3.THIRD_PARTY_BILLED,ir2_3.TRANSACTION_ID,ir2_3.UID,ir2_3.UPDATE_TIMESTAMP,ir2_2.BILLED,ir2_2.CANCELLED,ir2_2.EAC_CODE,ir2_1.CLIENT_TYPE,ir2_3.ID,e1_8.REASON,e1_11.REASON,rr2_0.ID,rr2_1.ACTIVE,rr2_1.AMOUNT_WITH_TAX,rr2_1.AMOUNT_WITHOUT_TAX,rr2_1.BATCH_ID,b5_0.ID,case when b5_1.ID is not null then 1 when b5_2.ID is not null then 2 when b5_3.ID is not null then 3 when b5_0.ID is not null then 0 end,b5_0.ACTIVE,a13_0.ID,case when a13_1.ID is not null then 1 when a13_2.ID is not null then 2 when a13_3.ID is not null then 3 when a13_0.ID is not null then 0 end,a13_0.ACTIVE,a13_0.BUILDING,a13_0.CITY,a13_0.COUNTRY,a13_0.CREATE_TIMESTAMP,a13_0.DETAILS,a13_0.ENTITY_VERSION,a13_0.NUMBER,a13_0.POSTAL_CODE,a13_0.REGION,a13_0.STREET_NAME,a13_0.UID,a13_0.UPDATE_TIMESTAMP,ba13_0.ID,case when ba13_1.ID is not null then 1 when ba13_2.ID is not null then 2 when ba13_3.ID is not null then 3 when ba13_0.ID is not null then 0 end,ba13_0.ACTIVE,ba13_0.BUILDING,ba13_0.CITY,ba13_0.COUNTRY,ba13_0.CREATE_TIMESTAMP,ba13_0.DETAILS,ba13_0.ENTITY_VERSION,ba13_0.NUMBER,ba13_0.POSTAL_CODE,ba13_0.REGION,ba13_0.STREET_NAME,ba13_0.UID,ba13_0.UPDATE_TIMESTAMP,b5_0.COMMERCIAL_NAME,b5_0.CREATE_TIMESTAMP,b5_0.ENTITY_VERSION,mc13_0.ID,case when mc13_1.ID is not null then 1 when mc13_2.ID is not null then 2 when mc13_3.ID is not null then 3 when mc13_0.ID is not null then 0 end,mc13_0.ACTIVE,mc13_0.CREATE_TIMESTAMP,mc13_0.EMAIL,mc13_0.ENTITY_VERSION,mc13_0.FAX,mc13_0.MOBILE,mc13_0.NAME,mc13_0.PHONE,mc13_0.UID,mc13_0.UPDATE_TIMESTAMP,mc13_0.WEBSITE,b5_0.NAME,oc5_0.ID,case when oc5_1.ID is not null then 1 when oc5_2.ID is not null then 2 when oc5_3.ID is not null then 3 when oc5_0.ID is not null then 0 end,oc5_0.ACTIVE,oc5_0.CREATE_TIMESTAMP,oc5_0.DESCRIPTION,oc5_0.ENTITY_VERSION,oc5_0.NAME,p10_0.ID,case when p10_1.ID is not null then 1 when p10_2.ID is not null then 2 when p10_3.ID is not null then 3 when p10_0.ID is not null then 0 end,p10_0.ACTIVE,p10_0.CREATE_TIMESTAMP,p10_0.DESCRIPTION,p10_0.ENTITY_VERSION,p10_0.NAME,p10_0.ID_CONTEXT_PARENT,p10_0.UID,p10_0.UPDATE_TIMESTAMP,p10_1.REGION_CODE,oc5_0.UID,oc5_0.UPDATE_TIMESTAMP,oc5_1.REGION_CODE,sa13_0.ID,case when sa13_1.ID is not null then 1 when sa13_2.ID is not null then 2 when sa13_3.ID is not null then 3 when sa13_0.ID is not null then 0 end,sa13_0.ACTIVE,sa13_0.BUILDING,sa13_0.CITY,sa13_0.COUNTRY,sa13_0.CREATE_TIMESTAMP,sa13_0.DETAILS,sa13_0.ENTITY_VERSION,sa13_0.NUMBER,sa13_0.POSTAL_CODE,sa13_0.REGION,sa13_0.STREET_NAME,sa13_0.UID,sa13_0.UPDATE_TIMESTAMP,b5_0.TAX_ID,b5_0.TAX_ID_COUNTRY,b5_0.timezone,b5_0.UID,b5_0.UPDATE_TIMESTAMP,b5_0.WEBSITE,rr2_1.CASH_VAT_ENDORSER,rr2_1.CREATE_TIMESTAMP,rr2_1.CREDIT_OR_DEBIT,rr2_1.CURRENCY,c5_0.ID,case when c5_1.ID is not null then 1 when c5_2.ID is not null then 2 when c5_3.ID is not null then 3 when c5_0.ID is not null then 0 end,c5_0.ACTIVE,ba14_0.ID,case when ba14_1.ID is not null then 1 when ba14_2.ID is not null then 2 when ba14_3.ID is not null then 3 when ba14_0.ID is not null then 0 end,ba14_0.ACTIVE,ba14_0.BUILDING,ba14_0.CITY,ba14_0.COUNTRY,ba14_0.CREATE_TIMESTAMP,ba14_0.DETAILS,ba14_0.ENTITY_VERSION,ba14_0.NUMBER,ba14_0.POSTAL_CODE,ba14_0.REGION,ba14_0.STREET_NAME,ba14_0.UID,ba14_0.UPDATE_TIMESTAMP,c5_0.CREATE_TIMESTAMP,c5_0.ENTITY_VERSION,ma9_0.ID,case when ma9_1.ID is not null then 1 when ma9_2.ID is not null then 2 when ma9_3.ID is not null then 3 when ma9_0.ID is not null then 0 end,ma9_0.ACTIVE,ma9_0.BUILDING,ma9_0.CITY,ma9_0.COUNTRY,ma9_0.CREATE_TIMESTAMP,ma9_0.DETAILS,ma9_0.ENTITY_VERSION,ma9_0.NUMBER,ma9_0.POSTAL_CODE,ma9_0.REGION,ma9_0.STREET_NAME,ma9_0.UID,ma9_0.UPDATE_TIMESTAMP,mc14_0.ID,case when mc14_1.ID is not null then 1 when mc14_2.ID is not null then 2 when mc14_3.ID is not null then 3 when mc14_0.ID is not null then 0 end,mc14_0.ACTIVE,mc14_0.CREATE_TIMESTAMP,mc14_0.EMAIL,mc14_0.ENTITY_VERSION,mc14_0.FAX,mc14_0.MOBILE,mc14_0.NAME,mc14_0.PHONE,mc14_0.UID,mc14_0.UPDATE_TIMESTAMP,mc14_0.WEBSITE,c5_0.NAME,c5_0.SELF_BILLING,sa14_0.ID,case when sa14_1.ID is not null then 1 when sa14_2.ID is not null then 2 when sa14_3.ID is not null then 3 when sa14_0.ID is not null then 0 end,sa14_0.ACTIVE,sa14_0.BUILDING,sa14_0.CITY,sa14_0.COUNTRY,sa14_0.CREATE_TIMESTAMP,sa14_0.DETAILS,sa14_0.ENTITY_VERSION,sa14_0.NUMBER,sa14_0.POSTAL_CODE,sa14_0.REGION,sa14_0.STREET_NAME,sa14_0.UID,sa14_0.UPDATE_TIMESTAMP,c5_0.TAX_ID,c5_0.TAX_ID_COUNTRY,c5_0.UID,c5_0.UPDATE_TIMESTAMP,c5_2.REFERRAL_NAME,c5_1.REFERRAL_NAME,c5_3.REFERRAL_NAME,rr2_1.DATE,rr2_1.DISCOUNTS_AMOUNT,rr2_1.ENTITY_VERSION,rr2_1.GENERAL_LEDGER_DATE,rr2_1.LOCAL_DATE,rr2_1.NUMBER,rr2_1.OFFICE_NUMBER,rr2_1.PAYMENT_TERMS,rr2_1.SCALE,rr2_1.SELF_BILLED,rr2_1.SERIES,rr2_1.SERIES_NUMBER,rr2_1.SETTLEMENT_DATE,rr2_1.SETTLEMENT_DESCRIPTION,rr2_1.SETTLEMENT_DISCOUNT,sd5_0.ID,case when sd5_1.ID is not null then 1 when sd5_2.ID is not null then 2 when sd5_3.ID is not null then 3 when sd5_0.ID is not null then 0 end,sd5_0.ACTIVE,a14_0.ID,case when a14_1.ID is not null then 1 when a14_2.ID is not null then 2 when a14_3.ID is not null then 3 when a14_0.ID is not null then 0 end,a14_0.ACTIVE,a14_0.BUILDING,a14_0.CITY,a14_0.COUNTRY,a14_0.CREATE_TIMESTAMP,a14_0.DETAILS,a14_0.ENTITY_VERSION,a14_0.NUMBER,a14_0.POSTAL_CODE,a14_0.REGION,a14_0.STREET_NAME,a14_0.UID,a14_0.UPDATE_TIMESTAMP,sd5_0.CREATE_TIMESTAMP,sd5_0.DATE,sd5_0.DELIVERY_ID,sd5_0.ENTITY_VERSION,sd5_0.LOCATION_ID,sd5_0.UCR,sd5_0.UID,sd5_0.UPDATE_TIMESTAMP,sd5_0.WAREHOUSE_ID,so5_0.ID,case when so5_1.ID is not null then 1 when so5_2.ID is not null then 2 when so5_3.ID is not null then 3 when so5_0.ID is not null then 0 end,so5_0.ACTIVE,a15_0.ID,case when a15_1.ID is not null then 1 when a15_2.ID is not null then 2 when a15_3.ID is not null then 3 when a15_0.ID is not null then 0 end,a15_0.ACTIVE,a15_0.BUILDING,a15_0.CITY,a15_0.COUNTRY,a15_0.CREATE_TIMESTAMP,a15_0.DETAILS,a15_0.ENTITY_VERSION,a15_0.NUMBER,a15_0.POSTAL_CODE,a15_0.REGION,a15_0.STREET_NAME,a15_0.UID,a15_0.UPDATE_TIMESTAMP,so5_0.CREATE_TIMESTAMP,so5_0.DATE,so5_0.DELIVERY_ID,so5_0.ENTITY_VERSION,so5_0.LOCATION_ID,so5_0.UCR,so5_0.UID,so5_0.UPDATE_TIMESTAMP,so5_0.WAREHOUSE_ID,rr2_1.SOURCE_ID,s5_0.ID,case when s5_1.ID is not null then 1 when s5_2.ID is not null then 2 when s5_3.ID is not null then 3 when s5_0.ID is not null then 0 end,s5_0.ACTIVE,ba15_0.ID,case when ba15_1.ID is not null then 1 when ba15_2.ID is not null then 2 when ba15_3.ID is not null then 3 when ba15_0.ID is not null then 0 end,ba15_0.ACTIVE,ba15_0.BUILDING,ba15_0.CITY,ba15_0.COUNTRY,ba15_0.CREATE_TIMESTAMP,ba15_0.DETAILS,ba15_0.ENTITY_VERSION,ba15_0.NUMBER,ba15_0.POSTAL_CODE,ba15_0.REGION,ba15_0.STREET_NAME,ba15_0.UID,ba15_0.UPDATE_TIMESTAMP,s5_0.CREATE_TIMESTAMP,s5_0.ENTITY_VERSION,ma10_0.ID,case when ma10_1.ID is not null then 1 when ma10_2.ID is not null then 2 when ma10_3.ID is not null then 3 when ma10_0.ID is not null then 0 end,ma10_0.ACTIVE,ma10_0.BUILDING,ma10_0.CITY,ma10_0.COUNTRY,ma10_0.CREATE_TIMESTAMP,ma10_0.DETAILS,ma10_0.ENTITY_VERSION,ma10_0.NUMBER,ma10_0.POSTAL_CODE,ma10_0.REGION,ma10_0.STREET_NAME,ma10_0.UID,ma10_0.UPDATE_TIMESTAMP,mc15_0.ID,case when mc15_1.ID is not null then 1 when mc15_2.ID is not null then 2 when mc15_3.ID is not null then 3 when mc15_0.ID is not null then 0 end,mc15_0.ACTIVE,mc15_0.CREATE_TIMESTAMP,mc15_0.EMAIL,mc15_0.ENTITY_VERSION,mc15_0.FAX,mc15_0.MOBILE,mc15_0.NAME,mc15_0.PHONE,mc15_0.UID,mc15_0.UPDATE_TIMESTAMP,mc15_0.WEBSITE,s5_0.NAME,s5_0.SELF_BILLING_AGREEMENT,sa15_0.ID,case when sa15_1.ID is not null then 1 when sa15_2.ID is not null then 2 when sa15_3.ID is not null then 3 when sa15_0.ID is not null then 0 end,sa15_0.ACTIVE,sa15_0.BUILDING,sa15_0.CITY,sa15_0.COUNTRY,sa15_0.CREATE_TIMESTAMP,sa15_0.DETAILS,sa15_0.ENTITY_VERSION,sa15_0.NUMBER,sa15_0.POSTAL_CODE,sa15_0.REGION,sa15_0.STREET_NAME,sa15_0.UID,sa15_0.UPDATE_TIMESTAMP,s5_0.TAX_ID,s5_0.TAX_ID_COUNTRY,s5_0.UID,s5_0.UPDATE_TIMESTAMP,s5_2.REFERRAL_NAME,s5_1.REFERRAL_NAME,s5_3.REFERRAL_NAME,rr2_1.TAX_AMOUNT,rr2_1.THIRD_PARTY_BILLED,rr2_1.TRANSACTION_ID,rr2_1.UID,rr2_1.UPDATE_TIMESTAMP,rr2_2.BILLED,rr2_2.CANCELLED,rr2_2.EAC_CODE,rr2_1.ID from BILLY_CORE_INVOICE_ENTRY e1_0 join (BILLY_CORE_GENERIC_INVOICE_ENTRY e1_1 left join BILLY_PT_CREDIT_NOTE_ENTRY e1_2 on e1_1.ID=e1_2.ID left join BILLY_PT_INVOICE_ENTRY e1_3 on e1_1.ID=e1_3.ID left join BILLY_AD_CREDIT_NOTE_ENTRY e1_4 on e1_1.ID=e1_4.ID left join BILLY_AD_INVOICE_ENTRY e1_5 on e1_1.ID=e1_5.ID left join BILLY_AD_RECEIPT_ENTRY e1_6 on e1_1.ID=e1_6.ID left join BILLY_AD_CREDIT_RECEIPT_ENTRY e1_7 on e1_1.ID=e1_7.ID left join BILLY_ES_CREDIT_NOTE_ENTRY e1_8 on e1_1.ID=e1_8.ID left join BILLY_ES_INVOICE_ENTRY e1_9 on e1_1.ID=e1_9.ID left join BILLY_ES_RECEIPT_ENTRY e1_10 on e1_1.ID=e1_10.ID left join BILLY_ES_CREDIT_RECEIPT_ENTRY e1_11 on e1_1.ID=e1_11.ID left join BILLY_PT_GENERIC_INVOICE_ENTRY e1_12 on e1_1.ID=e1_12.ID left join BILLY_AD_GENERIC_INVOICE_ENTRY e1_13 on e1_1.ID=e1_13.ID left join BILLY_ES_GENERIC_INVOICE_ENTRY e1_14 on e1_1.ID=e1_14.ID) on e1_1.ID=e1_0.ID_ENTRY left join (BILLY_CORE_PRODUCT p1_0 left join BILLY_PT_PRODUCT p1_1 on p1_0.ID=p1_1.ID left join BILLY_AD_PRODUCT p1_2 on p1_0.ID=p1_2.ID left join BILLY_ES_PRODUCT p1_3 on p1_0.ID=p1_3.ID) on p1_0.ID=e1_1.ID_PRODUCT left join (BILLY_AD_INVOICE ir1_0 left join BILLY_AD_SIMPLE_INVOICE ir1_1 on ir1_0.ID=ir1_1.ID join BILLY_AD_GENERIC_INVOICE ir1_2 on ir1_0.ID=ir1_2.ID join BILLY_CORE_GENERIC_INVOICE ir1_3 on ir1_0.ID=ir1_3.ID) on ir1_0.ID=e1_4.ID_ESINVOICE left join (BILLY_CORE_BUSINESS b1_0 left join BILLY_PT_BUSINESS b1_1 on b1_0.ID=b1_1.ID left join BILLY_AD_BUSINESS b1_2 on b1_0.ID=b1_2.ID left join BILLY_ES_BUSINESS b1_3 on b1_0.ID=b1_3.ID) on b1_0.ID=ir1_3.ID_BUSINESS left join (BILLY_CORE_ADDRESS a1_0 left join BILLY_PT_ADDRESS a1_1 on a1_0.ID=a1_1.ID left join BILLY_AD_ADDRESS a1_2 on a1_0.ID=a1_2.ID left join BILLY_ES_ADDRESS a1_3 on a1_0.ID=a1_3.ID) on a1_0.ID=b1_0.ID_ADDRESS left join (BILLY_CORE_ADDRESS ba1_0 left join BILLY_PT_ADDRESS ba1_1 on ba1_0.ID=ba1_1.ID left join BILLY_AD_ADDRESS ba1_2 on ba1_0.ID=ba1_2.ID left join BILLY_ES_ADDRESS ba1_3 on ba1_0.ID=ba1_3.ID) on ba1_0.ID=b1_0.ID_BILLING_ADDRESS left join (BILLY_CORE_CONTACT mc1_0 left join BILLY_PT_CONTACT mc1_1 on mc1_0.ID=mc1_1.ID left join BILLY_AD_CONTACT mc1_2 on mc1_0.ID=mc1_2.ID left join BILLY_ES_CONTACT mc1_3 on mc1_0.ID=mc1_3.ID) on mc1_0.ID=b1_0.ID_MAIN_CONTACT left join (BILLY_CORE_CONTEXT oc1_0 left join BILLY_PT_REGION_CONTEXT oc1_1 on oc1_0.ID=oc1_1.ID left join BILLY_AD_REGION_CONTEXT oc1_2 on oc1_0.ID=oc1_2.ID left join BILLY_ES_REGION_CONTEXT oc1_3 on oc1_0.ID=oc1_3.ID) on oc1_0.ID=b1_0.ID_OPERATIONAL_CONTEXT left join (BILLY_CORE_CONTEXT p2_0 left join BILLY_PT_REGION_CONTEXT p2_1 on p2_0.ID=p2_1.ID left join BILLY_AD_REGION_CONTEXT p2_2 on p2_0.ID=p2_2.ID left join BILLY_ES_REGION_CONTEXT p2_3 on p2_0.ID=p2_3.ID) on p2_0.ID=oc1_0.ID_CONTEXT_PARENT left join (BILLY_CORE_ADDRESS sa1_0 left join BILLY_PT_ADDRESS sa1_1 on sa1_0.ID=sa1_1.ID left join BILLY_AD_ADDRESS sa1_2 on sa1_0.ID=sa1_2.ID left join BILLY_ES_ADDRESS sa1_3 on sa1_0.ID=sa1_3.ID) on sa1_0.ID=b1_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_CUSTOMER c1_0 left join BILLY_PT_CUSTOMER c1_1 on c1_0.ID=c1_1.ID left join BILLY_AD_CUSTOMER c1_2 on c1_0.ID=c1_2.ID left join BILLY_ES_CUSTOMER c1_3 on c1_0.ID=c1_3.ID) on c1_0.ID=ir1_3.ID_CUSTOMER left join (BILLY_CORE_ADDRESS ba2_0 left join BILLY_PT_ADDRESS ba2_1 on ba2_0.ID=ba2_1.ID left join BILLY_AD_ADDRESS ba2_2 on ba2_0.ID=ba2_2.ID left join BILLY_ES_ADDRESS ba2_3 on ba2_0.ID=ba2_3.ID) on ba2_0.ID=c1_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma1_0 left join BILLY_PT_ADDRESS ma1_1 on ma1_0.ID=ma1_1.ID left join BILLY_AD_ADDRESS ma1_2 on ma1_0.ID=ma1_2.ID left join BILLY_ES_ADDRESS ma1_3 on ma1_0.ID=ma1_3.ID) on ma1_0.ID=c1_0.ID_ADDRESS left join (BILLY_CORE_CONTACT mc2_0 left join BILLY_PT_CONTACT mc2_1 on mc2_0.ID=mc2_1.ID left join BILLY_AD_CONTACT mc2_2 on mc2_0.ID=mc2_2.ID left join BILLY_ES_CONTACT mc2_3 on mc2_0.ID=mc2_3.ID) on mc2_0.ID=c1_0.ID_CONTACT left join (BILLY_CORE_ADDRESS sa2_0 left join BILLY_PT_ADDRESS sa2_1 on sa2_0.ID=sa2_1.ID left join BILLY_AD_ADDRESS sa2_2 on sa2_0.ID=sa2_2.ID left join BILLY_ES_ADDRESS sa2_3 on sa2_0.ID=sa2_3.ID) on sa2_0.ID=c1_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_SHIPPING_POINT sd1_0 left join BILLY_PT_SHIPPING_POINT sd1_1 on sd1_0.ID=sd1_1.ID left join BILLY_AD_SHIPPING_POINT sd1_2 on sd1_0.ID=sd1_2.ID left join BILLY_ES_SHIPPING_POINT sd1_3 on sd1_0.ID=sd1_3.ID) on sd1_0.ID=ir1_3.ID_SHIPPING_POINT_DESTINATION left join (BILLY_CORE_ADDRESS a2_0 left join BILLY_PT_ADDRESS a2_1 on a2_0.ID=a2_1.ID left join BILLY_AD_ADDRESS a2_2 on a2_0.ID=a2_2.ID left join BILLY_ES_ADDRESS a2_3 on a2_0.ID=a2_3.ID) on a2_0.ID=sd1_0.ID_ADDRESS left join (BILLY_CORE_SHIPPING_POINT so1_0 left join BILLY_PT_SHIPPING_POINT so1_1 on so1_0.ID=so1_1.ID left join BILLY_AD_SHIPPING_POINT so1_2 on so1_0.ID=so1_2.ID left join BILLY_ES_SHIPPING_POINT so1_3 on so1_0.ID=so1_3.ID) on so1_0.ID=ir1_3.ID_SHIPPING_POINT_ORIGIN left join (BILLY_CORE_ADDRESS a3_0 left join BILLY_PT_ADDRESS a3_1 on a3_0.ID=a3_1.ID left join BILLY_AD_ADDRESS a3_2 on a3_0.ID=a3_2.ID left join BILLY_ES_ADDRESS a3_3 on a3_0.ID=a3_3.ID) on a3_0.ID=so1_0.ID_ADDRESS left join (BILLY_CORE_SUPPLIER s1_0 left join BILLY_PT_SUPPLIER s1_1 on s1_0.ID=s1_1.ID left join BILLY_AD_SUPPLIER s1_2 on s1_0.ID=s1_2.ID left join BILLY_ES_SUPPLIER s1_3 on s1_0.ID=s1_3.ID) on s1_0.ID=ir1_3.ID_SUPPLIER left join (BILLY_CORE_ADDRESS ba3_0 left join BILLY_PT_ADDRESS ba3_1 on ba3_0.ID=ba3_1.ID left join BILLY_AD_ADDRESS ba3_2 on ba3_0.ID=ba3_2.ID left join BILLY_ES_ADDRESS ba3_3 on ba3_0.ID=ba3_3.ID) on ba3_0.ID=s1_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma2_0 left join BILLY_PT_ADDRESS ma2_1 on ma2_0.ID=ma2_1.ID left join BILLY_AD_ADDRESS ma2_2 on ma2_0.ID=ma2_2.ID left join BILLY_ES_ADDRESS ma2_3 on ma2_0.ID=ma2_3.ID) on ma2_0.ID=s1_0.ID_MAIN_ADDRESS left join (BILLY_CORE_CONTACT mc3_0 left join BILLY_PT_CONTACT mc3_1 on mc3_0.ID=mc3_1.ID left join BILLY_AD_CONTACT mc3_2 on mc3_0.ID=mc3_2.ID left join BILLY_ES_CONTACT mc3_3 on mc3_0.ID=mc3_3.ID) on mc3_0.ID=s1_0.ID_MAIN_CONTACT left join (BILLY_CORE_ADDRESS sa3_0 left join BILLY_PT_ADDRESS sa3_1 on sa3_0.ID=sa3_1.ID left join BILLY_AD_ADDRESS sa3_2 on sa3_0.ID=sa3_2.ID left join BILLY_ES_ADDRESS sa3_3 on sa3_0.ID=sa3_3.ID) on sa3_0.ID=s1_0.ID_SHIPPING_ADDRESS left join (BILLY_AD_RECEIPT rr1_0 join BILLY_CORE_GENERIC_INVOICE rr1_1 on rr1_0.ID=rr1_1.ID join BILLY_AD_GENERIC_INVOICE rr1_2 on rr1_0.ID=rr1_2.ID) on rr1_0.ID=e1_7.ID_ESRECEIPT left join (BILLY_CORE_BUSINESS b2_0 left join BILLY_PT_BUSINESS b2_1 on b2_0.ID=b2_1.ID left join BILLY_AD_BUSINESS b2_2 on b2_0.ID=b2_2.ID left join BILLY_ES_BUSINESS b2_3 on b2_0.ID=b2_3.ID) on b2_0.ID=rr1_1.ID_BUSINESS left join (BILLY_CORE_ADDRESS a4_0 left join BILLY_PT_ADDRESS a4_1 on a4_0.ID=a4_1.ID left join BILLY_AD_ADDRESS a4_2 on a4_0.ID=a4_2.ID left join BILLY_ES_ADDRESS a4_3 on a4_0.ID=a4_3.ID) on a4_0.ID=b2_0.ID_ADDRESS left join (BILLY_CORE_ADDRESS ba4_0 left join BILLY_PT_ADDRESS ba4_1 on ba4_0.ID=ba4_1.ID left join BILLY_AD_ADDRESS ba4_2 on ba4_0.ID=ba4_2.ID left join BILLY_ES_ADDRESS ba4_3 on ba4_0.ID=ba4_3.ID) on ba4_0.ID=b2_0.ID_BILLING_ADDRESS left join (BILLY_CORE_CONTACT mc4_0 left join BILLY_PT_CONTACT mc4_1 on mc4_0.ID=mc4_1.ID left join BILLY_AD_CONTACT mc4_2 on mc4_0.ID=mc4_2.ID left join BILLY_ES_CONTACT mc4_3 on mc4_0.ID=mc4_3.ID) on mc4_0.ID=b2_0.ID_MAIN_CONTACT left join (BILLY_CORE_CONTEXT oc2_0 left join BILLY_PT_REGION_CONTEXT oc2_1 on oc2_0.ID=oc2_1.ID left join BILLY_AD_REGION_CONTEXT oc2_2 on oc2_0.ID=oc2_2.ID left join BILLY_ES_REGION_CONTEXT oc2_3 on oc2_0.ID=oc2_3.ID) on oc2_0.ID=b2_0.ID_OPERATIONAL_CONTEXT left join (BILLY_CORE_CONTEXT p4_0 left join BILLY_PT_REGION_CONTEXT p4_1 on p4_0.ID=p4_1.ID left join BILLY_AD_REGION_CONTEXT p4_2 on p4_0.ID=p4_2.ID left join BILLY_ES_REGION_CONTEXT p4_3 on p4_0.ID=p4_3.ID) on p4_0.ID=oc2_0.ID_CONTEXT_PARENT left join (BILLY_CORE_ADDRESS sa4_0 left join BILLY_PT_ADDRESS sa4_1 on sa4_0.ID=sa4_1.ID left join BILLY_AD_ADDRESS sa4_2 on sa4_0.ID=sa4_2.ID left join BILLY_ES_ADDRESS sa4_3 on sa4_0.ID=sa4_3.ID) on sa4_0.ID=b2_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_CUSTOMER c2_0 left join BILLY_PT_CUSTOMER c2_1 on c2_0.ID=c2_1.ID left join BILLY_AD_CUSTOMER c2_2 on c2_0.ID=c2_2.ID left join BILLY_ES_CUSTOMER c2_3 on c2_0.ID=c2_3.ID) on c2_0.ID=rr1_1.ID_CUSTOMER left join (BILLY_CORE_ADDRESS ba5_0 left join BILLY_PT_ADDRESS ba5_1 on ba5_0.ID=ba5_1.ID left join BILLY_AD_ADDRESS ba5_2 on ba5_0.ID=ba5_2.ID left join BILLY_ES_ADDRESS ba5_3 on ba5_0.ID=ba5_3.ID) on ba5_0.ID=c2_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma3_0 left join BILLY_PT_ADDRESS ma3_1 on ma3_0.ID=ma3_1.ID left join BILLY_AD_ADDRESS ma3_2 on ma3_0.ID=ma3_2.ID left join BILLY_ES_ADDRESS ma3_3 on ma3_0.ID=ma3_3.ID) on ma3_0.ID=c2_0.ID_ADDRESS left join (BILLY_CORE_CONTACT mc5_0 left join BILLY_PT_CONTACT mc5_1 on mc5_0.ID=mc5_1.ID left join BILLY_AD_CONTACT mc5_2 on mc5_0.ID=mc5_2.ID left join BILLY_ES_CONTACT mc5_3 on mc5_0.ID=mc5_3.ID) on mc5_0.ID=c2_0.ID_CONTACT left join (BILLY_CORE_ADDRESS sa5_0 left join BILLY_PT_ADDRESS sa5_1 on sa5_0.ID=sa5_1.ID left join BILLY_AD_ADDRESS sa5_2 on sa5_0.ID=sa5_2.ID left join BILLY_ES_ADDRESS sa5_3 on sa5_0.ID=sa5_3.ID) on sa5_0.ID=c2_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_SHIPPING_POINT sd2_0 left join BILLY_PT_SHIPPING_POINT sd2_1 on sd2_0.ID=sd2_1.ID left join BILLY_AD_SHIPPING_POINT sd2_2 on sd2_0.ID=sd2_2.ID left join BILLY_ES_SHIPPING_POINT sd2_3 on sd2_0.ID=sd2_3.ID) on sd2_0.ID=rr1_1.ID_SHIPPING_POINT_DESTINATION left join (BILLY_CORE_ADDRESS a5_0 left join BILLY_PT_ADDRESS a5_1 on a5_0.ID=a5_1.ID left join BILLY_AD_ADDRESS a5_2 on a5_0.ID=a5_2.ID left join BILLY_ES_ADDRESS a5_3 on a5_0.ID=a5_3.ID) on a5_0.ID=sd2_0.ID_ADDRESS left join (BILLY_CORE_SHIPPING_POINT so2_0 left join BILLY_PT_SHIPPING_POINT so2_1 on so2_0.ID=so2_1.ID left join BILLY_AD_SHIPPING_POINT so2_2 on so2_0.ID=so2_2.ID left join BILLY_ES_SHIPPING_POINT so2_3 on so2_0.ID=so2_3.ID) on so2_0.ID=rr1_1.ID_SHIPPING_POINT_ORIGIN left join (BILLY_CORE_ADDRESS a6_0 left join BILLY_PT_ADDRESS a6_1 on a6_0.ID=a6_1.ID left join BILLY_AD_ADDRESS a6_2 on a6_0.ID=a6_2.ID left join BILLY_ES_ADDRESS a6_3 on a6_0.ID=a6_3.ID) on a6_0.ID=so2_0.ID_ADDRESS left join (BILLY_CORE_SUPPLIER s2_0 left join BILLY_PT_SUPPLIER s2_1 on s2_0.ID=s2_1.ID left join BILLY_AD_SUPPLIER s2_2 on s2_0.ID=s2_2.ID left join BILLY_ES_SUPPLIER s2_3 on s2_0.ID=s2_3.ID) on s2_0.ID=rr1_1.ID_SUPPLIER left join (BILLY_CORE_ADDRESS ba6_0 left join BILLY_PT_ADDRESS ba6_1 on ba6_0.ID=ba6_1.ID left join BILLY_AD_ADDRESS ba6_2 on ba6_0.ID=ba6_2.ID left join BILLY_ES_ADDRESS ba6_3 on ba6_0.ID=ba6_3.ID) on ba6_0.ID=s2_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma4_0 left join BILLY_PT_ADDRESS ma4_1 on ma4_0.ID=ma4_1.ID left join BILLY_AD_ADDRESS ma4_2 on ma4_0.ID=ma4_2.ID left join BILLY_ES_ADDRESS ma4_3 on ma4_0.ID=ma4_3.ID) on ma4_0.ID=s2_0.ID_MAIN_ADDRESS left join (BILLY_CORE_CONTACT mc6_0 left join BILLY_PT_CONTACT mc6_1 on mc6_0.ID=mc6_1.ID left join BILLY_AD_CONTACT mc6_2 on mc6_0.ID=mc6_2.ID left join BILLY_ES_CONTACT mc6_3 on mc6_0.ID=mc6_3.ID) on mc6_0.ID=s2_0.ID_MAIN_CONTACT left join (BILLY_CORE_ADDRESS sa6_0 left join BILLY_PT_ADDRESS sa6_1 on sa6_0.ID=sa6_1.ID left join BILLY_AD_ADDRESS sa6_2 on sa6_0.ID=sa6_2.ID left join BILLY_ES_ADDRESS sa6_3 on sa6_0.ID=sa6_3.ID) on sa6_0.ID=s2_0.ID_SHIPPING_ADDRESS left join (BILLY_PT_INVOICE r1_0 left join BILLY_PT_SIMPLE_INVOICE r1_1 on r1_0.ID=r1_1.ID left join BILLY_PT_RECEIPT_INVOICE r1_2 on r1_0.ID=r1_2.ID join BILLY_PT_GENERIC_INVOICE r1_3 on r1_0.ID=r1_3.ID join BILLY_CORE_GENERIC_INVOICE r1_4 on r1_0.ID=r1_4.ID) on r1_0.ID=e1_2.ID_PTINVOICE left join (BILLY_CORE_BUSINESS b3_0 left join BILLY_PT_BUSINESS b3_1 on b3_0.ID=b3_1.ID left join BILLY_AD_BUSINESS b3_2 on b3_0.ID=b3_2.ID left join BILLY_ES_BUSINESS b3_3 on b3_0.ID=b3_3.ID) on b3_0.ID=r1_4.ID_BUSINESS left join (BILLY_CORE_ADDRESS a7_0 left join BILLY_PT_ADDRESS a7_1 on a7_0.ID=a7_1.ID left join BILLY_AD_ADDRESS a7_2 on a7_0.ID=a7_2.ID left join BILLY_ES_ADDRESS a7_3 on a7_0.ID=a7_3.ID) on a7_0.ID=b3_0.ID_ADDRESS left join (BILLY_CORE_ADDRESS ba7_0 left join BILLY_PT_ADDRESS ba7_1 on ba7_0.ID=ba7_1.ID left join BILLY_AD_ADDRESS ba7_2 on ba7_0.ID=ba7_2.ID left join BILLY_ES_ADDRESS ba7_3 on ba7_0.ID=ba7_3.ID) on ba7_0.ID=b3_0.ID_BILLING_ADDRESS left join (BILLY_CORE_CONTACT mc7_0 left join BILLY_PT_CONTACT mc7_1 on mc7_0.ID=mc7_1.ID left join BILLY_AD_CONTACT mc7_2 on mc7_0.ID=mc7_2.ID left join BILLY_ES_CONTACT mc7_3 on mc7_0.ID=mc7_3.ID) on mc7_0.ID=b3_0.ID_MAIN_CONTACT left join (BILLY_CORE_CONTEXT oc3_0 left join BILLY_PT_REGION_CONTEXT oc3_1 on oc3_0.ID=oc3_1.ID left join BILLY_AD_REGION_CONTEXT oc3_2 on oc3_0.ID=oc3_2.ID left join BILLY_ES_REGION_CONTEXT oc3_3 on oc3_0.ID=oc3_3.ID) on oc3_0.ID=b3_0.ID_OPERATIONAL_CONTEXT left join (BILLY_CORE_CONTEXT p6_0 left join BILLY_PT_REGION_CONTEXT p6_1 on p6_0.ID=p6_1.ID left join BILLY_AD_REGION_CONTEXT p6_2 on p6_0.ID=p6_2.ID left join BILLY_ES_REGION_CONTEXT p6_3 on p6_0.ID=p6_3.ID) on p6_0.ID=oc3_0.ID_CONTEXT_PARENT left join (BILLY_CORE_ADDRESS sa7_0 left join BILLY_PT_ADDRESS sa7_1 on sa7_0.ID=sa7_1.ID left join BILLY_AD_ADDRESS sa7_2 on sa7_0.ID=sa7_2.ID left join BILLY_ES_ADDRESS sa7_3 on sa7_0.ID=sa7_3.ID) on sa7_0.ID=b3_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_CUSTOMER c3_0 left join BILLY_PT_CUSTOMER c3_1 on c3_0.ID=c3_1.ID left join BILLY_AD_CUSTOMER c3_2 on c3_0.ID=c3_2.ID left join BILLY_ES_CUSTOMER c3_3 on c3_0.ID=c3_3.ID) on c3_0.ID=r1_4.ID_CUSTOMER left join (BILLY_CORE_ADDRESS ba8_0 left join BILLY_PT_ADDRESS ba8_1 on ba8_0.ID=ba8_1.ID left join BILLY_AD_ADDRESS ba8_2 on ba8_0.ID=ba8_2.ID left join BILLY_ES_ADDRESS ba8_3 on ba8_0.ID=ba8_3.ID) on ba8_0.ID=c3_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma5_0 left join BILLY_PT_ADDRESS ma5_1 on ma5_0.ID=ma5_1.ID left join BILLY_AD_ADDRESS ma5_2 on ma5_0.ID=ma5_2.ID left join BILLY_ES_ADDRESS ma5_3 on ma5_0.ID=ma5_3.ID) on ma5_0.ID=c3_0.ID_ADDRESS left join (BILLY_CORE_CONTACT mc8_0 left join BILLY_PT_CONTACT mc8_1 on mc8_0.ID=mc8_1.ID left join BILLY_AD_CONTACT mc8_2 on mc8_0.ID=mc8_2.ID left join BILLY_ES_CONTACT mc8_3 on mc8_0.ID=mc8_3.ID) on mc8_0.ID=c3_0.ID_CONTACT left join (BILLY_CORE_ADDRESS sa8_0 left join BILLY_PT_ADDRESS sa8_1 on sa8_0.ID=sa8_1.ID left join BILLY_AD_ADDRESS sa8_2 on sa8_0.ID=sa8_2.ID left join BILLY_ES_ADDRESS sa8_3 on sa8_0.ID=sa8_3.ID) on sa8_0.ID=c3_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_SHIPPING_POINT sd3_0 left join BILLY_PT_SHIPPING_POINT sd3_1 on sd3_0.ID=sd3_1.ID left join BILLY_AD_SHIPPING_POINT sd3_2 on sd3_0.ID=sd3_2.ID left join BILLY_ES_SHIPPING_POINT sd3_3 on sd3_0.ID=sd3_3.ID) on sd3_0.ID=r1_4.ID_SHIPPING_POINT_DESTINATION left join (BILLY_CORE_ADDRESS a8_0 left join BILLY_PT_ADDRESS a8_1 on a8_0.ID=a8_1.ID left join BILLY_AD_ADDRESS a8_2 on a8_0.ID=a8_2.ID left join BILLY_ES_ADDRESS a8_3 on a8_0.ID=a8_3.ID) on a8_0.ID=sd3_0.ID_ADDRESS left join (BILLY_CORE_SHIPPING_POINT so3_0 left join BILLY_PT_SHIPPING_POINT so3_1 on so3_0.ID=so3_1.ID left join BILLY_AD_SHIPPING_POINT so3_2 on so3_0.ID=so3_2.ID left join BILLY_ES_SHIPPING_POINT so3_3 on so3_0.ID=so3_3.ID) on so3_0.ID=r1_4.ID_SHIPPING_POINT_ORIGIN left join (BILLY_CORE_ADDRESS a9_0 left join BILLY_PT_ADDRESS a9_1 on a9_0.ID=a9_1.ID left join BILLY_AD_ADDRESS a9_2 on a9_0.ID=a9_2.ID left join BILLY_ES_ADDRESS a9_3 on a9_0.ID=a9_3.ID) on a9_0.ID=so3_0.ID_ADDRESS left join (BILLY_CORE_SUPPLIER s3_0 left join BILLY_PT_SUPPLIER s3_1 on s3_0.ID=s3_1.ID left join BILLY_AD_SUPPLIER s3_2 on s3_0.ID=s3_2.ID left join BILLY_ES_SUPPLIER s3_3 on s3_0.ID=s3_3.ID) on s3_0.ID=r1_4.ID_SUPPLIER left join (BILLY_CORE_ADDRESS ba9_0 left join BILLY_PT_ADDRESS ba9_1 on ba9_0.ID=ba9_1.ID left join BILLY_AD_ADDRESS ba9_2 on ba9_0.ID=ba9_2.ID left join BILLY_ES_ADDRESS ba9_3 on ba9_0.ID=ba9_3.ID) on ba9_0.ID=s3_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma6_0 left join BILLY_PT_ADDRESS ma6_1 on ma6_0.ID=ma6_1.ID left join BILLY_AD_ADDRESS ma6_2 on ma6_0.ID=ma6_2.ID left join BILLY_ES_ADDRESS ma6_3 on ma6_0.ID=ma6_3.ID) on ma6_0.ID=s3_0.ID_MAIN_ADDRESS left join (BILLY_CORE_CONTACT mc9_0 left join BILLY_PT_CONTACT mc9_1 on mc9_0.ID=mc9_1.ID left join BILLY_AD_CONTACT mc9_2 on mc9_0.ID=mc9_2.ID left join BILLY_ES_CONTACT mc9_3 on mc9_0.ID=mc9_3.ID) on mc9_0.ID=s3_0.ID_MAIN_CONTACT left join (BILLY_CORE_ADDRESS sa9_0 left join BILLY_PT_ADDRESS sa9_1 on sa9_0.ID=sa9_1.ID left join BILLY_AD_ADDRESS sa9_2 on sa9_0.ID=sa9_2.ID left join BILLY_ES_ADDRESS sa9_3 on sa9_0.ID=sa9_3.ID) on sa9_0.ID=s3_0.ID_SHIPPING_ADDRESS left join (BILLY_ES_INVOICE ir2_0 left join BILLY_ES_SIMPLE_INVOICE ir2_1 on ir2_0.ID=ir2_1.ID join BILLY_ES_GENERIC_INVOICE ir2_2 on ir2_0.ID=ir2_2.ID join BILLY_CORE_GENERIC_INVOICE ir2_3 on ir2_0.ID=ir2_3.ID) on ir2_0.ID=e1_8.ID_ESINVOICE left join (BILLY_CORE_BUSINESS b4_0 left join BILLY_PT_BUSINESS b4_1 on b4_0.ID=b4_1.ID left join BILLY_AD_BUSINESS b4_2 on b4_0.ID=b4_2.ID left join BILLY_ES_BUSINESS b4_3 on b4_0.ID=b4_3.ID) on b4_0.ID=ir2_3.ID_BUSINESS left join (BILLY_CORE_ADDRESS a10_0 left join BILLY_PT_ADDRESS a10_1 on a10_0.ID=a10_1.ID left join BILLY_AD_ADDRESS a10_2 on a10_0.ID=a10_2.ID left join BILLY_ES_ADDRESS a10_3 on a10_0.ID=a10_3.ID) on a10_0.ID=b4_0.ID_ADDRESS left join (BILLY_CORE_ADDRESS ba10_0 left join BILLY_PT_ADDRESS ba10_1 on ba10_0.ID=ba10_1.ID left join BILLY_AD_ADDRESS ba10_2 on ba10_0.ID=ba10_2.ID left join BILLY_ES_ADDRESS ba10_3 on ba10_0.ID=ba10_3.ID) on ba10_0.ID=b4_0.ID_BILLING_ADDRESS left join (BILLY_CORE_CONTACT mc10_0 left join BILLY_PT_CONTACT mc10_1 on mc10_0.ID=mc10_1.ID left join BILLY_AD_CONTACT mc10_2 on mc10_0.ID=mc10_2.ID left join BILLY_ES_CONTACT mc10_3 on mc10_0.ID=mc10_3.ID) on mc10_0.ID=b4_0.ID_MAIN_CONTACT left join (BILLY_CORE_CONTEXT oc4_0 left join BILLY_PT_REGION_CONTEXT oc4_1 on oc4_0.ID=oc4_1.ID left join BILLY_AD_REGION_CONTEXT oc4_2 on oc4_0.ID=oc4_2.ID left join BILLY_ES_REGION_CONTEXT oc4_3 on oc4_0.ID=oc4_3.ID) on oc4_0.ID=b4_0.ID_OPERATIONAL_CONTEXT left join (BILLY_CORE_CONTEXT p8_0 left join BILLY_PT_REGION_CONTEXT p8_1 on p8_0.ID=p8_1.ID left join BILLY_AD_REGION_CONTEXT p8_2 on p8_0.ID=p8_2.ID left join BILLY_ES_REGION_CONTEXT p8_3 on p8_0.ID=p8_3.ID) on p8_0.ID=oc4_0.ID_CONTEXT_PARENT left join (BILLY_CORE_ADDRESS sa10_0 left join BILLY_PT_ADDRESS sa10_1 on sa10_0.ID=sa10_1.ID left join BILLY_AD_ADDRESS sa10_2 on sa10_0.ID=sa10_2.ID left join BILLY_ES_ADDRESS sa10_3 on sa10_0.ID=sa10_3.ID) on sa10_0.ID=b4_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_CUSTOMER c4_0 left join BILLY_PT_CUSTOMER c4_1 on c4_0.ID=c4_1.ID left join BILLY_AD_CUSTOMER c4_2 on c4_0.ID=c4_2.ID left join BILLY_ES_CUSTOMER c4_3 on c4_0.ID=c4_3.ID) on c4_0.ID=ir2_3.ID_CUSTOMER left join (BILLY_CORE_ADDRESS ba11_0 left join BILLY_PT_ADDRESS ba11_1 on ba11_0.ID=ba11_1.ID left join BILLY_AD_ADDRESS ba11_2 on ba11_0.ID=ba11_2.ID left join BILLY_ES_ADDRESS ba11_3 on ba11_0.ID=ba11_3.ID) on ba11_0.ID=c4_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma7_0 left join BILLY_PT_ADDRESS ma7_1 on ma7_0.ID=ma7_1.ID left join BILLY_AD_ADDRESS ma7_2 on ma7_0.ID=ma7_2.ID left join BILLY_ES_ADDRESS ma7_3 on ma7_0.ID=ma7_3.ID) on ma7_0.ID=c4_0.ID_ADDRESS left join (BILLY_CORE_CONTACT mc11_0 left join BILLY_PT_CONTACT mc11_1 on mc11_0.ID=mc11_1.ID left join BILLY_AD_CONTACT mc11_2 on mc11_0.ID=mc11_2.ID left join BILLY_ES_CONTACT mc11_3 on mc11_0.ID=mc11_3.ID) on mc11_0.ID=c4_0.ID_CONTACT left join (BILLY_CORE_ADDRESS sa11_0 left join BILLY_PT_ADDRESS sa11_1 on sa11_0.ID=sa11_1.ID left join BILLY_AD_ADDRESS sa11_2 on sa11_0.ID=sa11_2.ID left join BILLY_ES_ADDRESS sa11_3 on sa11_0.ID=sa11_3.ID) on sa11_0.ID=c4_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_SHIPPING_POINT sd4_0 left join BILLY_PT_SHIPPING_POINT sd4_1 on sd4_0.ID=sd4_1.ID left join BILLY_AD_SHIPPING_POINT sd4_2 on sd4_0.ID=sd4_2.ID left join BILLY_ES_SHIPPING_POINT sd4_3 on sd4_0.ID=sd4_3.ID) on sd4_0.ID=ir2_3.ID_SHIPPING_POINT_DESTINATION left join (BILLY_CORE_ADDRESS a11_0 left join BILLY_PT_ADDRESS a11_1 on a11_0.ID=a11_1.ID left join BILLY_AD_ADDRESS a11_2 on a11_0.ID=a11_2.ID left join BILLY_ES_ADDRESS a11_3 on a11_0.ID=a11_3.ID) on a11_0.ID=sd4_0.ID_ADDRESS left join (BILLY_CORE_SHIPPING_POINT so4_0 left join BILLY_PT_SHIPPING_POINT so4_1 on so4_0.ID=so4_1.ID left join BILLY_AD_SHIPPING_POINT so4_2 on so4_0.ID=so4_2.ID left join BILLY_ES_SHIPPING_POINT so4_3 on so4_0.ID=so4_3.ID) on so4_0.ID=ir2_3.ID_SHIPPING_POINT_ORIGIN left join (BILLY_CORE_ADDRESS a12_0 left join BILLY_PT_ADDRESS a12_1 on a12_0.ID=a12_1.ID left join BILLY_AD_ADDRESS a12_2 on a12_0.ID=a12_2.ID left join BILLY_ES_ADDRESS a12_3 on a12_0.ID=a12_3.ID) on a12_0.ID=so4_0.ID_ADDRESS left join (BILLY_CORE_SUPPLIER s4_0 left join BILLY_PT_SUPPLIER s4_1 on s4_0.ID=s4_1.ID left join BILLY_AD_SUPPLIER s4_2 on s4_0.ID=s4_2.ID left join BILLY_ES_SUPPLIER s4_3 on s4_0.ID=s4_3.ID) on s4_0.ID=ir2_3.ID_SUPPLIER left join (BILLY_CORE_ADDRESS ba12_0 left join BILLY_PT_ADDRESS ba12_1 on ba12_0.ID=ba12_1.ID left join BILLY_AD_ADDRESS ba12_2 on ba12_0.ID=ba12_2.ID left join BILLY_ES_ADDRESS ba12_3 on ba12_0.ID=ba12_3.ID) on ba12_0.ID=s4_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma8_0 left join BILLY_PT_ADDRESS ma8_1 on ma8_0.ID=ma8_1.ID left join BILLY_AD_ADDRESS ma8_2 on ma8_0.ID=ma8_2.ID left join BILLY_ES_ADDRESS ma8_3 on ma8_0.ID=ma8_3.ID) on ma8_0.ID=s4_0.ID_MAIN_ADDRESS left join (BILLY_CORE_CONTACT mc12_0 left join BILLY_PT_CONTACT mc12_1 on mc12_0.ID=mc12_1.ID left join BILLY_AD_CONTACT mc12_2 on mc12_0.ID=mc12_2.ID left join BILLY_ES_CONTACT mc12_3 on mc12_0.ID=mc12_3.ID) on mc12_0.ID=s4_0.ID_MAIN_CONTACT left join (BILLY_CORE_ADDRESS sa12_0 left join BILLY_PT_ADDRESS sa12_1 on sa12_0.ID=sa12_1.ID left join BILLY_AD_ADDRESS sa12_2 on sa12_0.ID=sa12_2.ID left join BILLY_ES_ADDRESS sa12_3 on sa12_0.ID=sa12_3.ID) on sa12_0.ID=s4_0.ID_SHIPPING_ADDRESS left join (BILLY_ES_RECEIPT rr2_0 join BILLY_CORE_GENERIC_INVOICE rr2_1 on rr2_0.ID=rr2_1.ID join BILLY_ES_GENERIC_INVOICE rr2_2 on rr2_0.ID=rr2_2.ID) on rr2_0.ID=e1_11.ID_ESRECEIPT left join (BILLY_CORE_BUSINESS b5_0 left join BILLY_PT_BUSINESS b5_1 on b5_0.ID=b5_1.ID left join BILLY_AD_BUSINESS b5_2 on b5_0.ID=b5_2.ID left join BILLY_ES_BUSINESS b5_3 on b5_0.ID=b5_3.ID) on b5_0.ID=rr2_1.ID_BUSINESS left join (BILLY_CORE_ADDRESS a13_0 left join BILLY_PT_ADDRESS a13_1 on a13_0.ID=a13_1.ID left join BILLY_AD_ADDRESS a13_2 on a13_0.ID=a13_2.ID left join BILLY_ES_ADDRESS a13_3 on a13_0.ID=a13_3.ID) on a13_0.ID=b5_0.ID_ADDRESS left join (BILLY_CORE_ADDRESS ba13_0 left join BILLY_PT_ADDRESS ba13_1 on ba13_0.ID=ba13_1.ID left join BILLY_AD_ADDRESS ba13_2 on ba13_0.ID=ba13_2.ID left join BILLY_ES_ADDRESS ba13_3 on ba13_0.ID=ba13_3.ID) on ba13_0.ID=b5_0.ID_BILLING_ADDRESS left join (BILLY_CORE_CONTACT mc13_0 left join BILLY_PT_CONTACT mc13_1 on mc13_0.ID=mc13_1.ID left join BILLY_AD_CONTACT mc13_2 on mc13_0.ID=mc13_2.ID left join BILLY_ES_CONTACT mc13_3 on mc13_0.ID=mc13_3.ID) on mc13_0.ID=b5_0.ID_MAIN_CONTACT left join (BILLY_CORE_CONTEXT oc5_0 left join BILLY_PT_REGION_CONTEXT oc5_1 on oc5_0.ID=oc5_1.ID left join BILLY_AD_REGION_CONTEXT oc5_2 on oc5_0.ID=oc5_2.ID left join BILLY_ES_REGION_CONTEXT oc5_3 on oc5_0.ID=oc5_3.ID) on oc5_0.ID=b5_0.ID_OPERATIONAL_CONTEXT left join (BILLY_CORE_CONTEXT p10_0 left join BILLY_PT_REGION_CONTEXT p10_1 on p10_0.ID=p10_1.ID left join BILLY_AD_REGION_CONTEXT p10_2 on p10_0.ID=p10_2.ID left join BILLY_ES_REGION_CONTEXT p10_3 on p10_0.ID=p10_3.ID) on p10_0.ID=oc5_0.ID_CONTEXT_PARENT left join (BILLY_CORE_ADDRESS sa13_0 left join BILLY_PT_ADDRESS sa13_1 on sa13_0.ID=sa13_1.ID left join BILLY_AD_ADDRESS sa13_2 on sa13_0.ID=sa13_2.ID left join BILLY_ES_ADDRESS sa13_3 on sa13_0.ID=sa13_3.ID) on sa13_0.ID=b5_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_CUSTOMER c5_0 left join BILLY_PT_CUSTOMER c5_1 on c5_0.ID=c5_1.ID left join BILLY_AD_CUSTOMER c5_2 on c5_0.ID=c5_2.ID left join BILLY_ES_CUSTOMER c5_3 on c5_0.ID=c5_3.ID) on c5_0.ID=rr2_1.ID_CUSTOMER left join (BILLY_CORE_ADDRESS ba14_0 left join BILLY_PT_ADDRESS ba14_1 on ba14_0.ID=ba14_1.ID left join BILLY_AD_ADDRESS ba14_2 on ba14_0.ID=ba14_2.ID left join BILLY_ES_ADDRESS ba14_3 on ba14_0.ID=ba14_3.ID) on ba14_0.ID=c5_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma9_0 left join BILLY_PT_ADDRESS ma9_1 on ma9_0.ID=ma9_1.ID left join BILLY_AD_ADDRESS ma9_2 on ma9_0.ID=ma9_2.ID left join BILLY_ES_ADDRESS ma9_3 on ma9_0.ID=ma9_3.ID) on ma9_0.ID=c5_0.ID_ADDRESS left join (BILLY_CORE_CONTACT mc14_0 left join BILLY_PT_CONTACT mc14_1 on mc14_0.ID=mc14_1.ID left join BILLY_AD_CONTACT mc14_2 on mc14_0.ID=mc14_2.ID left join BILLY_ES_CONTACT mc14_3 on mc14_0.ID=mc14_3.ID) on mc14_0.ID=c5_0.ID_CONTACT left join (BILLY_CORE_ADDRESS sa14_0 left join BILLY_PT_ADDRESS sa14_1 on sa14_0.ID=sa14_1.ID left join BILLY_AD_ADDRESS sa14_2 on sa14_0.ID=sa14_2.ID left join BILLY_ES_ADDRESS sa14_3 on sa14_0.ID=sa14_3.ID) on sa14_0.ID=c5_0.ID_SHIPPING_ADDRESS left join (BILLY_CORE_SHIPPING_POINT sd5_0 left join BILLY_PT_SHIPPING_POINT sd5_1 on sd5_0.ID=sd5_1.ID left join BILLY_AD_SHIPPING_POINT sd5_2 on sd5_0.ID=sd5_2.ID left join BILLY_ES_SHIPPING_POINT sd5_3 on sd5_0.ID=sd5_3.ID) on sd5_0.ID=rr2_1.ID_SHIPPING_POINT_DESTINATION left join (BILLY_CORE_ADDRESS a14_0 left join BILLY_PT_ADDRESS a14_1 on a14_0.ID=a14_1.ID left join BILLY_AD_ADDRESS a14_2 on a14_0.ID=a14_2.ID left join BILLY_ES_ADDRESS a14_3 on a14_0.ID=a14_3.ID) on a14_0.ID=sd5_0.ID_ADDRESS left join (BILLY_CORE_SHIPPING_POINT so5_0 left join BILLY_PT_SHIPPING_POINT so5_1 on so5_0.ID=so5_1.ID left join BILLY_AD_SHIPPING_POINT so5_2 on so5_0.ID=so5_2.ID left join BILLY_ES_SHIPPING_POINT so5_3 on so5_0.ID=so5_3.ID) on so5_0.ID=rr2_1.ID_SHIPPING_POINT_ORIGIN left join (BILLY_CORE_ADDRESS a15_0 left join BILLY_PT_ADDRESS a15_1 on a15_0.ID=a15_1.ID left join BILLY_AD_ADDRESS a15_2 on a15_0.ID=a15_2.ID left join BILLY_ES_ADDRESS a15_3 on a15_0.ID=a15_3.ID) on a15_0.ID=so5_0.ID_ADDRESS left join (BILLY_CORE_SUPPLIER s5_0 left join BILLY_PT_SUPPLIER s5_1 on s5_0.ID=s5_1.ID left join BILLY_AD_SUPPLIER s5_2 on s5_0.ID=s5_2.ID left join BILLY_ES_SUPPLIER s5_3 on s5_0.ID=s5_3.ID) on s5_0.ID=rr2_1.ID_SUPPLIER left join (BILLY_CORE_ADDRESS ba15_0 left join BILLY_PT_ADDRESS ba15_1 on ba15_0.ID=ba15_1.ID left join BILLY_AD_ADDRESS ba15_2 on ba15_0.ID=ba15_2.ID left join BILLY_ES_ADDRESS ba15_3 on ba15_0.ID=ba15_3.ID) on ba15_0.ID=s5_0.ID_BILLING_ADDRESS left join (BILLY_CORE_ADDRESS ma10_0 left join BILLY_PT_ADDRESS ma10_1 on ma10_0.ID=ma10_1.ID left join BILLY_AD_ADDRESS ma10_2 on ma10_0.ID=ma10_2.ID left join BILLY_ES_ADDRESS ma10_3 on ma10_0.ID=ma10_3.ID) on ma10_0.ID=s5_0.ID_MAIN_ADDRESS left join (BILLY_CORE_CONTACT mc15_0 left join BILLY_PT_CONTACT mc15_1 on mc15_0.ID=mc15_1.ID left join BILLY_AD_CONTACT mc15_2 on mc15_0.ID=mc15_2.ID left join BILLY_ES_CONTACT mc15_3 on mc15_0.ID=mc15_3.ID) on mc15_0.ID=s5_0.ID_MAIN_CONTACT left join (BILLY_CORE_ADDRESS sa15_0 left join BILLY_PT_ADDRESS sa15_1 on sa15_0.ID=sa15_1.ID left join BILLY_AD_ADDRESS sa15_2 on sa15_0.ID=sa15_2.ID left join BILLY_ES_ADDRESS sa15_3 on sa15_0.ID=sa15_3.ID) on sa15_0.ID=s5_0.ID_SHIPPING_ADDRESS where e1_0.ID_INVOICE=?] [ERROR: target lists can have at most 1664 entries] [n/a]
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:63)
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:94)
	at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.executeQuery(DeferredResultSetAccess.java:265)
	at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.getResultSet(DeferredResultSetAccess.java:167)
	at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.advanceNext(JdbcValuesResultSetImpl.java:218)
	at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.processNext(JdbcValuesResultSetImpl.java:98)
	at org.hibernate.sql.results.jdbc.internal.AbstractJdbcValues.next(AbstractJdbcValues.java:19)
	at org.hibernate.sql.results.internal.RowProcessingStateStandardImpl.next(RowProcessingStateStandardImpl.java:66)
	at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:181)
	at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:33)
	at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:209)
	at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:83)
	at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:76)
	at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:65)
	at org.hibernate.loader.ast.internal.CollectionLoaderSingleKey.load(CollectionLoaderSingleKey.java:120)
	at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:680)
	at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:67)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
	at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1712)
	at org.hibernate.collection.spi.AbstractPersistentCollection.lambda$initialize$3(AbstractPersistentCollection.java:615)
	at org.hibernate.collection.spi.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:264)
	at org.hibernate.collection.spi.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:613)
	at org.hibernate.collection.spi.AbstractPersistentCollection.read(AbstractPersistentCollection.java:136)
	at org.hibernate.collection.spi.PersistentBag.toString(PersistentBag.java:589)
	at java.base/java.lang.String.valueOf(String.java:4220)
	at java.base/java.io.PrintStream.println(PrintStream.java:1047)
	at DummyApp/dummyApp.app.App2.main(App2.java:35)
Caused by: org.postgresql.util.PSQLException: ERROR: target lists can have at most 1664 entries
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2712)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2400)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:367)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:507)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
	at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)
	at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.executeQuery(DeferredResultSetAccess.java:246)
	... 24 more

This is a limit in columns in a result set in Postgresql:
https://www.postgresql.org/docs/current/limits.html

Seems related to:

@froque froque force-pushed the 157-move-to-jakarta-packages branch from 0ff9909 to cdf1542 Compare December 6, 2023 23:08
<querydsl.version>5.0.0</querydsl.version>
<hibernate.version>5.6.15.Final</hibernate.version>
<hibernate.version>6.3.1.Final</hibernate.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to Jakarta does not require to upgrade to Hibernate v6

We can move to hibernate-core-jakarta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move to jakarta packages
2 participants