Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] EEnum attributes getting reset after a query
[Teneo] EEnum attributes getting reset after a query [message #597068] Tue, 19 December 2006 06:09
Eclipse UserFriend
Originally posted by: Stephen.Egan.csiro.au

Hi,
I'm experiencing very peculiar behaviour with EEnum attributes in my =

system. I've run some tests where I create an object that has an EEnum =
as =

an attribute. When I save the object, all is well, however when I run =

another test that retrieves that object, the attribute gets reset back t=
o =

it's default! This is particularly curious as I have run a query with o=
ne =

of the query parameters being the literal for the EEnum that gets =

changed! I've included a snippet below. Any ideas as to what might be =
=

going wrong?

//Stephen

public void testPersistence () {
UserAccount account =3D SupportFactory.eINSTANCE.createUserAccount();
account.setAccountStatus(AccountStatus.NORMAL_LITERAL);
account.setAdmin(false);
account.setLdapUid("test");
account.setLgonlineId(666l);
account.setRole("Tester");
account.setSpecialAuthority(false);
Session session =3D InitSessionFactory.getCurrentSession();
session.beginTransaction();
RoadAuthorityDao dao =3D new RoadAuthorityDao();
RoadAuthority ra =3D PartyRoleFactory.eINSTANCE.createRoadAuthority();=

ra.setName("Mundubbera");
List<RoadAuthority> l =3D dao.findByExample(ra);
if (l.size() =3D=3D1) {
ra =3D l.get(0);
} else {
System.out.println("No RA for Mundubbera");
System.exit(-1);
}
account.setRoadAuthority(ra);
session.save(account);
session.getTransaction().commit();
session =3D InitSessionFactory.getCurrentSession();
session.beginTransaction();
UserAccount ua2 =3D (new UserAccountDao()).findById(account.getId());
System.out.println(account.getAccountStatus().getName()); //Still =

AccountStatus.NORMAL_LITERAL
System.out.println(ua2.getAccountStatus().getName()); //Now =

AccountStatus.AUTH_REQ (first literal in the enum)
session.getTransaction().commit();
}
Previous Topic:[Teneo] GMF -mindmap example problem
Next Topic:[Teneo] Should we use Hibernate or JDO?
Goto Forum:
  


Current Time: Sat Apr 27 04:33:48 GMT 2024

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

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

Back to the top