Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » can't add data
can't add data [message #603041] Thu, 01 March 2007 19:45
Paul Gardiner is currently offline Paul GardinerFriend
Messages: 94
Registered: July 2009
Member
I'm trying to add some emf objects like in the tutorial step 3. I can
create the root object, but then when I try to add something to a list in
that object, it doesn't work. The Server object below returns an
EList<Plugin> object. When I add a Plugin object to the EList, it seems to
work, but then when I read it back again, nothing is there. I put in a
flush, and reopened the session to see what would happen, and even
re-queried, but no use. I must be doing something incorrectly. Any ideas?

public Server addPlugin(String serverID,Plugin plugin) throws
ModelServiceException
{
Session session=sessionFactory.openSession();
Query query=session.createQuery("FROM Server where id='"+serverID+"'");
Server server=(Server)query.list().get(0);
getLogger().info("initial plugin count:"+server.getPlugins().size());
session.beginTransaction();
server.getPlugins().add(plugin);
session.getTransaction().commit();
session.flush();
session.close();
session=sessionFactory.openSession();
query=session.createQuery("FROM Server where id='"+serverID+"'");
server=(Server)query.list().get(0);
getLogger().info("new plugin count:"+server.getPlugins().size());
return server;

}

Output from the log statements shows count of zero.
Previous Topic:can't add data
Next Topic:[Teneo] Can't add data
Goto Forum:
  


Current Time: Fri Apr 19 23:27:15 GMT 2024

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

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

Back to the top