Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358098

Summary: JPA Content not shown after loading of target platform
Product: [WebTools] Dali JPA Tools Reporter: Vladislav Iliev <vladislav.iliev>
Component: FrameworkAssignee: Brian Vosburgh <brian.vosburgh>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: mathias.kinzler, neil.hauge, stefan.dimov
Version: 3.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch for both HEAD and R3_0_maintenance branches none

Description Vladislav Iliev CLA 2011-09-19 08:02:48 EDT
Steps to reproduce:
1. File -> New -> (Other)-> JPA Project.
2. Enter project name.
3. In section "Target runtime" create new runtime environment and use it.
4.In the configuration section, click on button "Modify" and select "OSGI Bundle" from the "Project facet" list.
5. Go back to the New JPA Project page.
6. Click on Finish.

A new JPA project has been created. The target platform associated with the chosen  runtime is not active. Also there should be JPA Content node in the project explorer view, under which there is a persistence.xml item.

7. Go to Window->Preferences, Target Platform and activate it.

Expected:
The JPA project view should not be changed.

Actual:
The item persistence.xml initially located under JPA Content node dissapeared.
Comment 1 Kaloyan Raev CLA 2011-09-19 08:15:12 EDT
Vladi, could you check if the workaround for bug 352121 works for this one too?
Comment 2 Vladislav Iliev CLA 2011-09-19 08:24:12 EDT
Yes, selecting Project->Clean... makes things a little bit better. As a result the presitence.xml appears, but theere is an validation error:

"The persistence.xml file does not have recognized content"
If I do Project -> Clean.. again and voala the xml file is there and there and the error disappears.
A similar workaround is to do twice right click on the project -> Validate.

An easier workaround is to close and open the project.
Comment 3 Stefan Dimov CLA 2011-10-06 09:43:55 EDT
I'm moving this bug to Dali, because I think the problem is in Dali - not in Libra. Although I'm not sure, I think that there is some synchronization problem related to updating the JPA project model.

I've made some experiments. In the method:

private JobCommand buildUpdateJobCommand(final JpaProject jpaProject)

of class:

org.eclipse.jpt.jpa.core.GenericJpaProjectManager

I've replaced 'jpaProject.update(monitor)' with 'jpaProject.updateAndWait()'

It seems to work (to some extent). With that change the JPA project model already is being updated properly (in the scenario described above) altough I get some errors in the log when I'm changing the target platforms for the first time. Obviously, this is not the correct approach and I'm not familiar enough with the synchronizations in the JPA model, so please someone give me some hints/info how to handle the synchronization problem here.
Comment 4 Stefan Dimov CLA 2011-10-07 09:08:09 EDT
Created attachment 204745 [details]
patch for both HEAD and R3_0_maintenance branches

This is a patch implementing what I describe in comment #3. It could be used as a "go on" point for investigation.
Comment 5 Neil Hauge CLA 2012-05-10 10:55:41 EDT
We have made some large changes in Juno with regard to how project building/sync, which may have resolved this issue.  It would be great if someone could try this out with the latest Dali Juno M7 code and report their findings.
Comment 6 Neil Hauge CLA 2012-05-17 14:00:07 EDT
Comment on attachment 204745 [details]
patch for both HEAD and R3_0_maintenance branches

Attached patch would now be obsolete with new Dali code.
Comment 7 Neil Hauge CLA 2013-09-04 16:44:26 EDT
Downgrading severity as no one has shown much interest in this bug in a while.