Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Eclipselink retrieves old data, but data is already updated in the database. Where does it get the old data from?


in my project I have to Eclipse RCP plugins. Both are configured to
use Eclipselink on one and the same database. Both get the same
If the first plugin, showing some views to add data to the database,
is started it shows the data from the database and the operation
directly write to the database and I can see, with an 3rd party
database manager tool, that the changes are saved in the database.

Then from my menu the second plugin is called. It will just read the
data and then show and do some visualisation with it, it shows data
which is old. All new added or modified objects from my first plugin
are not shown. I have to quit the program and restart it, and then my
second plugin also sees the changes.

Since the database connection for my second plugin is established
after the first plugin flushed all data and closed the transaction, ..

...why does my second plugin not see the changes?

my code is more or less:

private List<A> aList = new ArrayList<A>();

public void loadData() {

dbDriver = get...
dbUrl = get...
dbUser = get...
dbPass = get...

if (dbUrl.contains("derby:")) setLocalDatabase(true);

Map properties = new HashMap();
properties.put("javax.persistence.jdbc.driver", dbDriver);
properties.put("javax.persistence.jdbc.url", dbUrl);
properties.put("javax.persistence.jdbc.user", dbUser);
properties.put("javax.persistence.jdbc.password", dbPass);
try {
	factory = Persistence.createEntityManagerFactory(
} catch (Exception e) {
em = factory.createEntityManager();

Query q1 = em.createQuery("SELECT m FROM A m ORDER BY m.position, ASC");



Can you help and tell my what I am doing wrong? Why doesnt the second
plugin see the changes?



Back to the top