Hi
I have a base class entity with two drive class for single table. In base class there are some static finder method that is related to the database. So I created a finder aspect for that. It works fine from eclipse but when I run it from roo or maven then I got compiler error-
Base class-
Finder aspect for purchase with generic static methodCode:@RooEntity(versionField = "", table = "T_P") @Inheritance(strategy=InheritanceType.SINGLE_TABLE); @DiscriminatorColumn(name="CLASS_TYPE_DISCRIMINATOR", discriminatorType=DiscriminatorType.INTEGER); @DiscriminatorValue("0"); public class Purchase{ }
Compiler error code
Sub class-Code:aspect Purchase_Finder{ public static <U extends Purchase> Long Purchase.countPurchases(Class<U> type) { }
Test case for content purchaseCode:@Entity @DiscriminatorValue(value="1"); public ContentPurchase extend Purchase{ }
When I run this test case from eclipse then it works fine. But when I run it through roo or maven I get the following error-Code:@ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml") @RunWith(SpringJUnit4ClassRunner.class) @Transactional public class ContentPurchaseTest { @Test public void countContentTest(){ Long contentCount = ContentPurchase .countPurchases(ContentPurchase .class); Assert.assertNotNull(contentCount ); Assert.assertTrue(contentCount >0); } }
ContentPurchaseTest .java: The method countPurchases(Class<ContentPurchase >) is ambiguous for the type ContentPurchase
One more things- If I move those static method from aspectj to java class then it works fine both eclipse and roo.
Working code -
I have also other method that are common for sub class are working fine from eclipse project but neither roo nor maven.Code:public class Purchase{ //moving code from asject public static <U extends Purchase> Long countPurchases(Class<U> type) { } aspect Purchase_Finder{ }
Regards
Mamun


Reply With Quote
