History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-31412
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Gregory Shrago
Reporter: erik freed
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Two JPA EJB persistence units in one project/EAR

Created: 11 Aug 08 02:59   Updated: 16 Oct 08 17:27
Component/s: J2EE.EJB3
Fix Version/s: Diana 8940

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Vista 64/Intel Quad Core
Issue Links:
Duplicate
 
This issue is duplicated by:
IDEADEV-31413 erroneous "More than one attribute co... Normal Resolved
IDEADEV-31414 I keep getting 'More than one attribu... Normal Resolved

Build: 8,664
Fixed in build: 8,916
Severity: Extreme


 Description  « Hide
When I have two persistence units in a project, each a separate module, deployed separately within the single EAR in the project, any EJB Entity Bean you place in one persistence unit shows up once in the metadata for one module and twice in the second module. This leads to any persistent field in a given EJB failing validation because of multiple definition for that field. Strangely each has four definitions instead of three. I have cleared all caches, recreated the project files from scratch, and scanned the project and module files for multiple definitions – all seems ok. I have spent a lot of time on this trying to get it to work including trying to add EJBs to either module to see if they are duplicated as well – they are. Since I have two
persistence units in my project I am no dead in the water. This also fails on prior builds - I don't think its a 8664 specific problem.

 All   Comments   Work Log   Change History      Sort Order:
erik freed - 11 Aug 08 03:01
two additions/corrections
  • I meant to say 'I am now dead in the water'
    -Both persistence units share a common EJB datasource.

erik freed - 11 Aug 08 18:47
This may help – I again deleted and recreated from scratch all project structure (project and module files) and cache and the first time I compiled the project it validated fine – the second time I compiled the project I again got the double definitions of all types in both persistence units.

Gregory Shrago - 13 Aug 08 21:03
It seems that your modules depend on each other.
You should probably use "exclude-unlisted-classes".
At the moment deployment configuration is not taken into account, this is an issue.

erik freed - 27 Aug 08 23:43
Could this be the same problem that others are facing with the 'more than on dependency injection configured" ejb validation errors? I have that problem as well which means that EJB validation pretty much is useless for anything but trivial projects. Doesn't this seem like a pretty big bug? Could you add something to testing regimen that includes these sorts of ejbs dependent on ejbs in a different jar scenario? Apparently this test would shake out some interesting problems.

Gregory Shrago - 28 Aug 08 16:51
I've fixed the EJB problem but JPA case is a bit different so I still cannot reproduce it.

Can you create and post here some simple project which will expose the issue?
I promise it will be fixed ASAP


Dichen Mao - 30 Aug 08 23:15
I spent some time on this issue, too. However, since i was relying on the ANT buider, this wasn't a blocker to me. And I also happened to find one of the workaround if you have to use IDEA to compile your code. Hope this info is helpful.

so, i happened to have a super abstract class for some session beans and by doing this the IDEA thinks it's ok.

abstract class
protected SomeEJB some;
abstract void setSome(SomeEJB some);

then, implement the dummy setter in each of the concrete session bean:

concrete class
@EJB void setSome(SomeEJ some){ this.some = some;}

erik freed - 04 Sep 08 06:08
Hey Gregory,

Really sorry to be unhelpful but my project is pretty huge and proprietary and I am on deadline after getting back from vacation – so I can't send you what I have and don't have time to recreate something smaller and non-proprietary.

I can say that is that its two persistence units in two layers where the upper layer one depends on the lower layer one (unidirectional). If I turn off the dependency all is fine, if I turn the dependency on I get a series of 'more than one attribute configured for field' on whatever fields are there. If I turn the dependency off – the duplications go away. And if I switch to JAVA EE structure view - it shows that the lower layer JPA facet has two of each of its entity beans and the upper layer one has the same duplicates from the lower layer in its set of entity beans without duplicates of its entity beans. Translated that means the lower layer beans are being duplicated both in the lower layer facet and in the upper layer facet. The entity beans in the upper layer facet seem to be ok. If y ou have two beans in the lower layer and two beans in the upper layer you get four beans in the lower layer and 6 in the upper layer. Turn off the dependency and you get two in each layer.

Hope that helps!

erik


erik freed - 05 Sep 08 20:20
Problem still exists in build 8769

erik freed - 03 Oct 08 19:22
Here is another nudge to fix this – I would like to turn on validation again someday.