Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » sync error with eclipselink
sync error with eclipselink [message #729565] Mon, 26 September 2011 14:10 Go to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi all
i'm facing a GIANT problem here

here's the scneario: we have a RCP app, using google guice to inject dependencies.
we have a view, that lists all our companies. and when double clicked, the view opens a edior, and we can edit this company. ok, everything works perfectly here. until we change the data and DO NOT save.
when we change the company name, and save, everything is ok, but when we change the company name and just close the editor, seems like it changes the entity on the database (but it doesn't) and the entirely session get the wrong object.
we changed the company name from 'asd' to 'asd123', and we do not saved this change. but everytime we get the username (e.g.: 'select e from Empresa e where e.id = :id') eclipselink get the 'asd123' company
is this some 'cache problem' or something?

some details:
when we open the editor we (aparently) reload the entity that was passed via EditorInput
@Override
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
		EmpresaEditorInput eei = (EmpresaEditorInput) input;

		empresaHandler.setEmpresa(empresaHandler.findEmpresa(eei.getEmpresa().getId()));

		setSite(site);
		setInput(eei);
	}


my entitymaneger, with cache disabled

private static void init() {
		properties.put(PersistenceUnitProperties.TARGET_DATABASE, TargetDatabase.PostgreSQL);
		properties.put(PersistenceUnitProperties.JDBC_DRIVER, Driver.class.getCanonicalName());
		properties.put(PersistenceUnitProperties.JDBC_URL,"jdbc:postgresql://127.0.0.1:5432/ecf");
		properties.put(PersistenceUnitProperties.JDBC_USER, "postgres");
		properties.put(PersistenceUnitProperties.JDBC_PASSWORD, "adminadmin");
		properties.put(PersistenceUnitProperties.CONNECTION_POOL_MIN, "5");
		properties.put(PersistenceUnitProperties.CONNECTION_POOL_MAX, "10");
		properties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT,"false");
		properties.put(PersistenceUnitProperties.CACHE_STATEMENTS,"false");
		properties.put(PersistenceUnitProperties.BATCH_WRITING, "JDBC");
		properties.put(PersistenceUnitProperties.CLASSLOADER, Bootstrap.class.getClassLoader());
		
		// Cria tabelas novas (mas não atualiza)
//		properties.put(PersistenceUnitProperties.DDL_GENERATION, "create-tables");
		
		properties.put("eclipselink.logging.level", "FINE");
		properties.put("eclipselink.logging.timestamp", "false");
		properties.put("eclipselink.logging.session", "false");
		properties.put("eclipselink.logging.thread", "false");
		properties.put("eclipselink.logging.exceptions", "true");

		emf = new PersistenceProvider().createEntityManagerFactory("ecf", properties);



if i set the queryhint to always refresh the cache (when loading a specficif company and load all companies), it works, but i dont want that.

the scope of my repository is no singleton, so everytime I get the repository, is a new one.

any ideas?

thanks in advice
Re: sync error with eclipselink [message #729631 is a reply to message #729565] Mon, 26 September 2011 16:46 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
anyone?
seems like that these entities (my companies list and my company model) are sharing some cache or anything like...http://www.eclipse.org/forums/index.php/r/frm_id/111/
Re: sync error with eclipselink [message #729634 is a reply to message #729631] Mon, 26 September 2011 16:53 Go to previous message
Wolfgang  is currently offline Wolfgang Friend
Messages: 10
Registered: July 2009
Junior Member
not sure what part of your question is still open - eclipselink uses caching, you best look this up in the doco.
If you change the object returned by eclipselink you make the cached object dirty.
So you have at least two options - either work on a copy (clone) of the cached object and merge this back when the change is committed or work on the original and refresh if cancelled

hope this helps
W.
Re: sync error with eclipselink [message #729636 is a reply to message #729565] Mon, 26 September 2011 16:46 Go to previous message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
anyone?
seems like that these entities (my companies list and my company model) are sharing some cache or anything like...http://www.eclipse.org/forums/index.php/r/frm_id/111/
Previous Topic:@EmbeddedId in conjunction with InheritanceType.JOINED does not generate PK-Field
Next Topic:StackOverFlowError on Eclipselink commit
Goto Forum:
  


Current Time: Tue Mar 19 06:17:39 GMT 2024

Powered by FUDForum. Page generated in 0.02016 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top