You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Rick Bonnett <rb...@mesca.com> on 2013/12/11 17:13:15 UTC

Eclipse runnable jar file can't find cayenne resources

This is using 3.1B2.


>From Eclipse, I export my project as a runnable jar file. When I try to execute it from bash, I get this exception thrown at startup:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: org.apache.cayenne.configuration.server.DataDomainLoadException: [v.3.1B2 Feb 05 2013 20:19:35] Configuration resource "cayenne-MongoTariffConversion.xml" is not found.
at org.apache.cayenne.configuration.server.DataDomainProvider.createAndInitDataDomain(DataDomainProvider.java:143)
at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:106)
at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:60)
at org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:38)
at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:107)
at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMember(FieldInjectingProvider.java:93)
at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(FieldInjectingProvider.java:58)
at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:43)
at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
at org.apache.cayenne.configuration.CayenneRuntime.getContext(CayenneRuntime.java:180)
at com.mesca.conversion.mongo.LTLTariffConverter.ConvertLTLTariff(LTLTariffConverter.java:29)
at com.mesca.conversion.mongo.TariffConverter.main(TariffConverter.java:37)
... 5 more


Any ideas what is going wrong here? I’ve tried various things with the build path and export properties in my Eclipse project, all to no avail.
Thanks for any help or suggestions

Here’s the output form jar tvf on my jar file:

jar tvf TariffConverter.jar
   559 Wed Dec 11 11:01:10 EST 2013 META-INF/MANIFEST.MF
     0 Wed Dec 11 11:01:10 EST 2013 org/
     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/
     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/
     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/
     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/
   978 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class
   714 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class
  4735 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class
  1505 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class
  1841 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class
  1149 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class
358048 Wed Dec 11 11:01:10 EST 2013 commons-configuration-1.9.jar
284220 Wed Dec 11 11:01:10 EST 2013 commons-lang-2.6.jar
421246 Wed Dec 11 11:01:10 EST 2013 velocity-1.6.3.jar
 63966 Wed Dec 11 11:01:10 EST 2013 avalon-framework-4.1.3.jar
 77977 Wed Dec 11 11:01:10 EST 2013 servlet-api-2.3.jar
     0 Wed Dec 11 10:42:44 EST 2013 com/
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/
  5237 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/DoNotRateZipConverter.class
  1376 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/ConversionUtilities.class
 17268 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/LTLTariffConverter.class
 13772 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/CarrierConverter.class
  4405 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/TariffConverter.class
  2142 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/RateModuleHelper.class
  6724 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/ServiceRegionConverter.class
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/
   394 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyPltCodeMatrix.class
   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyFuel.class
   366 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/PltCodeMatrix.class
   581 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/MongoTariffConversion.class
   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyCarrierFuel.class
   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Accessorial.class
   370 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyPltRate.class
   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Carrier.class
   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyAbsoluteMin.class
   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierAccessorial.class
   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyAccessorial.class
   366 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/DonotrateZips.class
   354 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyFak.class
   374 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyDiscount.class
   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/PltRate.class
   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/ETariff.class
   382 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierGtedCharge.class
   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Company.class
   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierFuel.class
   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierAbsoluteMin.class
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/
 10917 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyFak.class
 11323 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Company.class
  3231 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_PltRate.class
  1798 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_DonotrateZips.class
  2400 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierGtedCharge.class
  8487 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Carrier.class
  6342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_PltCodeMatrix.class
  1604 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Accessorial.class
  7534 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierAbsoluteMin.class
 10393 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyAccessorial.class
  3709 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyPltRate.class
  8274 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyDiscount.class
   367 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_MongoTariffConversion.class
  4624 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_ETariff.class
  6820 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyPltCodeMatrix.class
  7107 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyAbsoluteMin.class
  5237 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyFuel.class
  8803 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierAccessorial.class
  4037 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierFuel.class
  4285 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyCarrierFuel.class
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/
   385 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/CompanyServiceRegion.class
   564 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/SvcRregionConversion.class
   385 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/CarrierServiceRegion.class
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/
  2476 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_CompanyServiceRegion.class
   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_SvcRregionConversion.class
  2361 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_CarrierServiceRegion.class
     0 Tue Dec 10 15:24:00 EST 2013 main/
     0 Tue Dec 10 15:24:00 EST 2013 main/resources/
 77398 Tue Dec 10 15:24:00 EST 2013 main/resources/MongoTariffConversion.map.xml
  3357 Wed Dec 04 09:46:16 EST 2013 main/resources/SvcRregionConversion.map.xml
   606 Tue Dec 10 15:24:00 EST 2013 main/resources/cayenne-MongoTariffConversion.xml
   602 Wed Dec 04 09:46:16 EST 2013 main/resources/cayenne-SvcRegionConversion.xml
    74 Wed Jul 10 09:50:08 EDT 2013 main/resources/commons-logging.properties
   201 Tue Dec 03 07:20:24 EST 2013 main/resources/simplelog.properties
358085 Wed Dec 11 11:01:10 EST 2013 log4j-1.2.12.jar
     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/
  4036 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/TariffRule.class
  1923 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/ServiceRegion.class
   692 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/AbsoluteMinimumCharge.class
   708 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/GuaranteedDeliveryCharge.class
  4029 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/FAK.class
  2311 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Accessorial.class
  1776 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/RateModule.class
  5536 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Tariff.class
  2215 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletRate.class
  1280 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/DoNotRateZip.class
   924 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Discount.class
  1856 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletTariff.class
  1584 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/LTLTariff.class
   931 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/TariffStatus.class
  2195 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Fuel.class
  2793 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletCode.class
  4989 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/CarrierTariff.class
539705 Wed Dec 11 11:01:10 EST 2013 postgresql-9.1-901.jdbc4.jar
 52915 Wed Dec 11 11:01:10 EST 2013 commons-logging-1.1.jar
189285 Wed Dec 11 11:01:10 EST 2013 gson-2.2.2.jar
575389 Wed Dec 11 11:01:10 EST 2013 commons-collections-3.2.1.jar
 41123 Wed Dec 11 11:01:10 EST 2013 commons-cli-1.2.jar
 72150 Wed Dec 11 11:01:10 EST 2013 logkit-1.0.1.jar
275728 Wed Dec 11 11:01:10 EST 2013 morphia-0.105.jar
1983246 Wed Dec 11 11:01:10 EST 2013 cayenne-server-3.1B2.jar
 65261 Wed Dec 11 11:01:10 EST 2013 oro-2.0.8.jar
419054 Wed Dec 11 11:01:10 EST 2013 mongo-java-driver-2.11.3.jar


And here’s the content of my MANIFEST file from the jar:

Manifest-Version: 1.0
Rsrc-Class-Path: ./ log4j-1.2.12.jar avalon-framework-4.1.3.jar common
 s-lang-2.6.jar velocity-1.6.3.jar commons-collections-3.2.1.jar commo
 ns-logging-1.1.jar morphia-0.105.jar oro-2.0.8.jar cayenne-server-3.1
 B2.jar postgresql-9.1-901.jdbc4.jar commons-configuration-1.9.jar gso
 n-2.2.2.jar logkit-1.0.1.jar mongo-java-driver-2.11.3.jar servlet-api
 -2.3.jar commons-cli-1.2.jar
Class-Path: .
Rsrc-Main-Class: com.mesca.conversion.mongo.TariffConverter
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader




Re: Inheritance Question

Posted by do...@xsinet.co.za.
Hi Andrus

Thanks, I have done something like that:

I created an ObjEntity called ImageMeta without the BLOB field, and then 
another ObjEntity called ImageBlob with just the BLOB field.

I then added a method to ImageMeta that retrieves ImageBlob when required.

This pattern works great for selects, but not for inserts because BLOB may 
not be null.

So I created an ObjEntity called ImageNew (that inherited from ImageMeta) 
that has all the needed fields for a successful insertion.
However this degraded the performance of ImageMeta selects because Cayenne 
was now retrieving the BLOBs as well.

Jurgen


-----Original Message----- 
From: Andrus Adamchik
Sent: Friday, December 20, 2013 10:25 AM
To: user@cayenne.apache.org
Subject: Re: Inheritance Question

If your result list is not expected to contain ClassTwo objects, you won’t 
see any blobs. But if it is - you will get fully resolved ClassTwo objects, 
including the BLOB attribute.

So perhaps BLOB should be placed in a separate table and lazily resolved via 
relationship?

Andrus

On Dec 20, 2013, at 10:49 AM, dollj@xsinet.co.za wrote:

> Thanks for asking Andrus:
>
> Because ClassTwo contains a BLOB that I don't want retrieved when asking 
> for ClassOne objects.
>
> Jurgen
>
>
> -----Original Message----- From: Andrus Adamchik
> Sent: Friday, December 20, 2013 8:58 AM
> To: user@cayenne.apache.org
> Subject: Re: Inheritance Question
>
> No.
>
> But a question though - if the result set only contains ClassOne rows, why 
> would you care about inclusion of all those extra columns in the SELECT?
>
> Andrus
>
> On Dec 20, 2013, at 9:50 AM, dollj@xsinet.co.za wrote:
>
>> Thanks for your reply Andrus.
>>
>> I don't suppose that there is a way to tell Cayenne not to be so eager in 
>> this case ?
>>
>> Jurgen
>>
>>
>> -----Original Message----- From: Andrus Adamchik
>> Sent: Friday, December 20, 2013 8:27 AM
>> To: user@cayenne.apache.org
>> Subject: Re: Inheritance Question
>>
>> From what I can tell, this is the intended behavior. If your SelectQuery 
>> root is ClassOne, Cayenne expects that the result might contain a mix of 
>> ClassOne and any of its subclasses (which means ClassTwo as well). So the 
>> columns in SELECT are a superset of columns for all the classes involved.
>>
>> Andrus
>>
>>
>> On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
>>> Hi All
>>>
>>> I have a dbEntity say ClassOne (its lightweight) and another that 
>>> inherits from it as ClassTwo (its heavyweight).
>>>
>>> Now in my case I have a prefetch that retrieves ClassOne objects.
>>>
>>> The problem that I have is that Cayenne is fetching ClassTwo data as 
>>> well ?!
>>>
>>> Surely Cayenne should only be fetching the ClassOne data, why is 
>>> ClassTwo data also being retrieved ?
>>>
>>> Is this the intended behaviour ?   Is there a way to prevent it ?
>>>
>>> Thanks, Jurgen
>>>
>>>
>>>
>>
>>
>
>


Re: Inheritance Question

Posted by Andrus Adamchik <an...@objectstyle.org>.
If your result list is not expected to contain ClassTwo objects, you won’t see any blobs. But if it is - you will get fully resolved ClassTwo objects, including the BLOB attribute.

So perhaps BLOB should be placed in a separate table and lazily resolved via relationship?

Andrus

On Dec 20, 2013, at 10:49 AM, dollj@xsinet.co.za wrote:

> Thanks for asking Andrus:
> 
> Because ClassTwo contains a BLOB that I don't want retrieved when asking for ClassOne objects.
> 
> Jurgen
> 
> 
> -----Original Message----- From: Andrus Adamchik
> Sent: Friday, December 20, 2013 8:58 AM
> To: user@cayenne.apache.org
> Subject: Re: Inheritance Question
> 
> No.
> 
> But a question though - if the result set only contains ClassOne rows, why would you care about inclusion of all those extra columns in the SELECT?
> 
> Andrus
> 
> On Dec 20, 2013, at 9:50 AM, dollj@xsinet.co.za wrote:
> 
>> Thanks for your reply Andrus.
>> 
>> I don't suppose that there is a way to tell Cayenne not to be so eager in this case ?
>> 
>> Jurgen
>> 
>> 
>> -----Original Message----- From: Andrus Adamchik
>> Sent: Friday, December 20, 2013 8:27 AM
>> To: user@cayenne.apache.org
>> Subject: Re: Inheritance Question
>> 
>> From what I can tell, this is the intended behavior. If your SelectQuery root is ClassOne, Cayenne expects that the result might contain a mix of ClassOne and any of its subclasses (which means ClassTwo as well). So the columns in SELECT are a superset of columns for all the classes involved.
>> 
>> Andrus
>> 
>> 
>> On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
>>> Hi All
>>> 
>>> I have a dbEntity say ClassOne (its lightweight) and another that inherits from it as ClassTwo (its heavyweight).
>>> 
>>> Now in my case I have a prefetch that retrieves ClassOne objects.
>>> 
>>> The problem that I have is that Cayenne is fetching ClassTwo data as well ?!
>>> 
>>> Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo data also being retrieved ?
>>> 
>>> Is this the intended behaviour ?   Is there a way to prevent it ?
>>> 
>>> Thanks, Jurgen
>>> 
>>> 
>>> 
>> 
>> 
> 
> 


Re: Inheritance Question

Posted by do...@xsinet.co.za.
Thanks for asking Andrus:

Because ClassTwo contains a BLOB that I don't want retrieved when asking for 
ClassOne objects.

Jurgen


-----Original Message----- 
From: Andrus Adamchik
Sent: Friday, December 20, 2013 8:58 AM
To: user@cayenne.apache.org
Subject: Re: Inheritance Question

No.

But a question though - if the result set only contains ClassOne rows, why 
would you care about inclusion of all those extra columns in the SELECT?

Andrus

On Dec 20, 2013, at 9:50 AM, dollj@xsinet.co.za wrote:

> Thanks for your reply Andrus.
>
> I don't suppose that there is a way to tell Cayenne not to be so eager in 
> this case ?
>
> Jurgen
>
>
> -----Original Message----- From: Andrus Adamchik
> Sent: Friday, December 20, 2013 8:27 AM
> To: user@cayenne.apache.org
> Subject: Re: Inheritance Question
>
> From what I can tell, this is the intended behavior. If your SelectQuery 
> root is ClassOne, Cayenne expects that the result might contain a mix of 
> ClassOne and any of its subclasses (which means ClassTwo as well). So the 
> columns in SELECT are a superset of columns for all the classes involved.
>
> Andrus
>
>
> On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
>> Hi All
>>
>> I have a dbEntity say ClassOne (its lightweight) and another that 
>> inherits from it as ClassTwo (its heavyweight).
>>
>> Now in my case I have a prefetch that retrieves ClassOne objects.
>>
>> The problem that I have is that Cayenne is fetching ClassTwo data as well 
>> ?!
>>
>> Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo 
>> data also being retrieved ?
>>
>> Is this the intended behaviour ?   Is there a way to prevent it ?
>>
>> Thanks, Jurgen
>>
>>
>>
>
>


Re: Inheritance Question

Posted by Andrus Adamchik <an...@objectstyle.org>.
No.

But a question though - if the result set only contains ClassOne rows, why would you care about inclusion of all those extra columns in the SELECT?

Andrus 

On Dec 20, 2013, at 9:50 AM, dollj@xsinet.co.za wrote:

> Thanks for your reply Andrus.
> 
> I don't suppose that there is a way to tell Cayenne not to be so eager in this case ?
> 
> Jurgen
> 
> 
> -----Original Message----- From: Andrus Adamchik
> Sent: Friday, December 20, 2013 8:27 AM
> To: user@cayenne.apache.org
> Subject: Re: Inheritance Question
> 
> From what I can tell, this is the intended behavior. If your SelectQuery root is ClassOne, Cayenne expects that the result might contain a mix of ClassOne and any of its subclasses (which means ClassTwo as well). So the columns in SELECT are a superset of columns for all the classes involved.
> 
> Andrus
> 
> 
> On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
>> Hi All
>> 
>> I have a dbEntity say ClassOne (its lightweight) and another that inherits from it as ClassTwo (its heavyweight).
>> 
>> Now in my case I have a prefetch that retrieves ClassOne objects.
>> 
>> The problem that I have is that Cayenne is fetching ClassTwo data as well ?!
>> 
>> Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo data also being retrieved ?
>> 
>> Is this the intended behaviour ?   Is there a way to prevent it ?
>> 
>> Thanks, Jurgen
>> 
>> 
>> 
> 
> 


Re: Inheritance Question

Posted by do...@xsinet.co.za.
Thanks for your reply Andrus.

I don't suppose that there is a way to tell Cayenne not to be so eager in 
this case ?

Jurgen


-----Original Message----- 
From: Andrus Adamchik
Sent: Friday, December 20, 2013 8:27 AM
To: user@cayenne.apache.org
Subject: Re: Inheritance Question

>From what I can tell, this is the intended behavior. If your SelectQuery 
root is ClassOne, Cayenne expects that the result might contain a mix of 
ClassOne and any of its subclasses (which means ClassTwo as well). So the 
columns in SELECT are a superset of columns for all the classes involved.

Andrus


On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
> Hi All
>
> I have a dbEntity say ClassOne (its lightweight) and another that inherits 
> from it as ClassTwo (its heavyweight).
>
> Now in my case I have a prefetch that retrieves ClassOne objects.
>
> The problem that I have is that Cayenne is fetching ClassTwo data as well 
> ?!
>
> Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo 
> data also being retrieved ?
>
> Is this the intended behaviour ?   Is there a way to prevent it ?
>
> Thanks, Jurgen
>
>
>


Re: Inheritance Question

Posted by Andrus Adamchik <an...@objectstyle.org>.
From what I can tell, this is the intended behavior. If your SelectQuery root is ClassOne, Cayenne expects that the result might contain a mix of ClassOne and any of its subclasses (which means ClassTwo as well). So the columns in SELECT are a superset of columns for all the classes involved. 

Andrus


On Dec 12, 2013, at 12:30 PM, dollj@xsinet.co.za wrote:
> Hi All
> 
> I have a dbEntity say ClassOne (its lightweight) and another that inherits from it as ClassTwo (its heavyweight).
> 
> Now in my case I have a prefetch that retrieves ClassOne objects.
> 
> The problem that I have is that Cayenne is fetching ClassTwo data as well ?!
> 
> Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo data also being retrieved ?
> 
> Is this the intended behaviour ?   Is there a way to prevent it ?
> 
> Thanks, Jurgen
> 
> 
> 


Inheritance Question

Posted by do...@xsinet.co.za.
Hi All

I have a dbEntity say ClassOne (its lightweight) and another that inherits 
from it as ClassTwo (its heavyweight).

Now in my case I have a prefetch that retrieves ClassOne objects.

The problem that I have is that Cayenne is fetching ClassTwo data as well ?!

Surely Cayenne should only be fetching the ClassOne data, why is ClassTwo 
data also being retrieved ?

Is this the intended behaviour ?   Is there a way to prevent it ?

Thanks, Jurgen



Re: Eclipse runnable jar file can't find cayenne resources

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, your XML file must be in the jar root, but instead it ended up in main/resources folder:

>  606 Tue Dec 10 15:24:00 EST 2013 main/resources/cayenne-MongoTariffConversion.xml

So you will either need to make sure that Eclipse treats “main/resources” as a source folder (I think this should fix the structure), or pass the name to ServerRuntime as "main/resources/cayenne-MongoTariffConversion.xml" 

HTH
Andrus

On Dec 11, 2013, at 7:13 PM, Rick Bonnett <rb...@mesca.com> wrote:

> This is using 3.1B2.
> 
> 
> From Eclipse, I export my project as a runnable jar file. When I try to execute it from bash, I get this exception thrown at startup:
> 
> Exception in thread "main" java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
> Caused by: org.apache.cayenne.configuration.server.DataDomainLoadException: [v.3.1B2 Feb 05 2013 20:19:35] Configuration resource "cayenne-MongoTariffConversion.xml" is not found.
> at org.apache.cayenne.configuration.server.DataDomainProvider.createAndInitDataDomain(DataDomainProvider.java:143)
> at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:106)
> at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:60)
> at org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:38)
> at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
> at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
> at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:107)
> at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMember(FieldInjectingProvider.java:93)
> at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(FieldInjectingProvider.java:58)
> at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:43)
> at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
> at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> at org.apache.cayenne.configuration.CayenneRuntime.getContext(CayenneRuntime.java:180)
> at com.mesca.conversion.mongo.LTLTariffConverter.ConvertLTLTariff(LTLTariffConverter.java:29)
> at com.mesca.conversion.mongo.TariffConverter.main(TariffConverter.java:37)
> ... 5 more
> 
> 
> Any ideas what is going wrong here? I’ve tried various things with the build path and export properties in my Eclipse project, all to no avail.
> Thanks for any help or suggestions
> 
> Here’s the output form jar tvf on my jar file:
> 
> jar tvf TariffConverter.jar
>   559 Wed Dec 11 11:01:10 EST 2013 META-INF/MANIFEST.MF
>     0 Wed Dec 11 11:01:10 EST 2013 org/
>     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/
>     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/
>     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/
>     0 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/
>   978 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class
>   714 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class
>  4735 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class
>  1505 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class
>  1841 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class
>  1149 Wed Dec 11 11:01:10 EST 2013 org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class
> 358048 Wed Dec 11 11:01:10 EST 2013 commons-configuration-1.9.jar
> 284220 Wed Dec 11 11:01:10 EST 2013 commons-lang-2.6.jar
> 421246 Wed Dec 11 11:01:10 EST 2013 velocity-1.6.3.jar
> 63966 Wed Dec 11 11:01:10 EST 2013 avalon-framework-4.1.3.jar
> 77977 Wed Dec 11 11:01:10 EST 2013 servlet-api-2.3.jar
>     0 Wed Dec 11 10:42:44 EST 2013 com/
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/
>  5237 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/DoNotRateZipConverter.class
>  1376 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/ConversionUtilities.class
> 17268 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/LTLTariffConverter.class
> 13772 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/CarrierConverter.class
>  4405 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/TariffConverter.class
>  2142 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/RateModuleHelper.class
>  6724 Wed Dec 11 10:42:44 EST 2013 com/mesca/conversion/mongo/ServiceRegionConverter.class
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/
>   394 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyPltCodeMatrix.class
>   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyFuel.class
>   366 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/PltCodeMatrix.class
>   581 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/MongoTariffConversion.class
>   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyCarrierFuel.class
>   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Accessorial.class
>   370 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyPltRate.class
>   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Carrier.class
>   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyAbsoluteMin.class
>   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierAccessorial.class
>   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyAccessorial.class
>   366 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/DonotrateZips.class
>   354 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyFak.class
>   374 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CompanyDiscount.class
>   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/PltRate.class
>   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/ETariff.class
>   382 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierGtedCharge.class
>   342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/Company.class
>   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierFuel.class
>   386 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/CarrierAbsoluteMin.class
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/
> 10917 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyFak.class
> 11323 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Company.class
>  3231 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_PltRate.class
>  1798 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_DonotrateZips.class
>  2400 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierGtedCharge.class
>  8487 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Carrier.class
>  6342 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_PltCodeMatrix.class
>  1604 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_Accessorial.class
>  7534 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierAbsoluteMin.class
> 10393 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyAccessorial.class
>  3709 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyPltRate.class
>  8274 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyDiscount.class
>   367 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_MongoTariffConversion.class
>  4624 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_ETariff.class
>  6820 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyPltCodeMatrix.class
>  7107 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyAbsoluteMin.class
>  5237 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyFuel.class
>  8803 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierAccessorial.class
>  4037 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CarrierFuel.class
>  4285 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/conversionTariff/auto/_CompanyCarrierFuel.class
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/
>   385 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/CompanyServiceRegion.class
>   564 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/SvcRregionConversion.class
>   385 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/CarrierServiceRegion.class
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/
>  2476 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_CompanyServiceRegion.class
>   358 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_SvcRregionConversion.class
>  2361 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/serviceRegion/auto/_CarrierServiceRegion.class
>     0 Tue Dec 10 15:24:00 EST 2013 main/
>     0 Tue Dec 10 15:24:00 EST 2013 main/resources/
> 77398 Tue Dec 10 15:24:00 EST 2013 main/resources/MongoTariffConversion.map.xml
>  3357 Wed Dec 04 09:46:16 EST 2013 main/resources/SvcRregionConversion.map.xml
>   606 Tue Dec 10 15:24:00 EST 2013 main/resources/cayenne-MongoTariffConversion.xml
>   602 Wed Dec 04 09:46:16 EST 2013 main/resources/cayenne-SvcRegionConversion.xml
>    74 Wed Jul 10 09:50:08 EDT 2013 main/resources/commons-logging.properties
>   201 Tue Dec 03 07:20:24 EST 2013 main/resources/simplelog.properties
> 358085 Wed Dec 11 11:01:10 EST 2013 log4j-1.2.12.jar
>     0 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/
>  4036 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/TariffRule.class
>  1923 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/ServiceRegion.class
>   692 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/AbsoluteMinimumCharge.class
>   708 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/GuaranteedDeliveryCharge.class
>  4029 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/FAK.class
>  2311 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Accessorial.class
>  1776 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/RateModule.class
>  5536 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Tariff.class
>  2215 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletRate.class
>  1280 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/DoNotRateZip.class
>   924 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Discount.class
>  1856 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletTariff.class
>  1584 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/LTLTariff.class
>   931 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/TariffStatus.class
>  2195 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/Fuel.class
>  2793 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/PalletCode.class
>  4989 Wed Dec 11 10:42:44 EST 2013 com/mesca/model/tariff/CarrierTariff.class
> 539705 Wed Dec 11 11:01:10 EST 2013 postgresql-9.1-901.jdbc4.jar
> 52915 Wed Dec 11 11:01:10 EST 2013 commons-logging-1.1.jar
> 189285 Wed Dec 11 11:01:10 EST 2013 gson-2.2.2.jar
> 575389 Wed Dec 11 11:01:10 EST 2013 commons-collections-3.2.1.jar
> 41123 Wed Dec 11 11:01:10 EST 2013 commons-cli-1.2.jar
> 72150 Wed Dec 11 11:01:10 EST 2013 logkit-1.0.1.jar
> 275728 Wed Dec 11 11:01:10 EST 2013 morphia-0.105.jar
> 1983246 Wed Dec 11 11:01:10 EST 2013 cayenne-server-3.1B2.jar
> 65261 Wed Dec 11 11:01:10 EST 2013 oro-2.0.8.jar
> 419054 Wed Dec 11 11:01:10 EST 2013 mongo-java-driver-2.11.3.jar
> 
> 
> And here’s the content of my MANIFEST file from the jar:
> 
> Manifest-Version: 1.0
> Rsrc-Class-Path: ./ log4j-1.2.12.jar avalon-framework-4.1.3.jar common
> s-lang-2.6.jar velocity-1.6.3.jar commons-collections-3.2.1.jar commo
> ns-logging-1.1.jar morphia-0.105.jar oro-2.0.8.jar cayenne-server-3.1
> B2.jar postgresql-9.1-901.jdbc4.jar commons-configuration-1.9.jar gso
> n-2.2.2.jar logkit-1.0.1.jar mongo-java-driver-2.11.3.jar servlet-api
> -2.3.jar commons-cli-1.2.jar
> Class-Path: .
> Rsrc-Main-Class: com.mesca.conversion.mongo.TariffConverter
> Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
> 
> 
>