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 #64822] |
Tue, 19 December 2006 01:09  |
Eclipse User |
|
|
|
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();
}
|
|
| |
Re: [Teneo] EEnum attributes getting reset after a query [message #64865 is a reply to message #64844] |
Tue, 19 December 2006 03:22   |
Eclipse User |
|
|
|
Hi Stephen,
Thanks for the extra info. This is a mismatch between Teneo and the way EMF handles enums (it
changed a while back).
Can you enter a bugzilla for this? There will be a solution in the next release.
gr. Martin
Stephen Egan wrote:
> Update: This only happens to EEnums that have different values for
> their "name" and "literal" values. At least I have a work around....
> On Tue, 19 Dec 2006 17:09:09 +1100, Stephen Egan
> <Stephen.Egan@csiro.au> wrote:
>
>> 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 to it's default! This is particularly curious as I have
>> run a query with one 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 =
>> 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 = InitSessionFactory.getCurrentSession();
>> session.beginTransaction();
>> RoadAuthorityDao dao = new RoadAuthorityDao();
>> RoadAuthority ra =
>> PartyRoleFactory.eINSTANCE.createRoadAuthority();
>> ra.setName("Mundubbera");
>> List<RoadAuthority> l = dao.findByExample(ra);
>> if (l.size() ==1) {
>> ra = l.get(0);
>> } else {
>> System.out.println("No RA for Mundubbera");
>> System.exit(-1);
>> }
>> account.setRoadAuthority(ra);
>> session.save(account);
>> session.getTransaction().commit();
>> session = InitSessionFactory.getCurrentSession();
>> session.beginTransaction();
>> UserAccount ua2 = (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();
>> }
>
>
>
> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] EEnum attributes getting reset after a query [message #65079 is a reply to message #64865] |
Tue, 19 December 2006 21:10  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Thanks very much Martin,
I've submitted bug number 168623
//Stephen
On Tue, 19 Dec 2006 19:22:20 +1100, Martin Taal <mtaal@elver.org> wrote:=
> Hi Stephen,
> Thanks for the extra info. This is a mismatch between Teneo and the wa=
y =
> EMF handles enums (it changed a while back).
> Can you enter a bugzilla for this? There will be a solution in the nex=
t =
> release.
>
> gr. Martin
>
> Stephen Egan wrote:
>> Update: This only happens to EEnums that have different values for =
>> their "name" and "literal" values. At least I have a work around....=
>> On Tue, 19 Dec 2006 17:09:09 +1100, Stephen Egan =
>> <Stephen.Egan@csiro.au> wrote:
>>
>>> 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 ge=
ts =
>>> reset back to it's default! This is particularly curious as I have =
=
>>> run a query with one of the query parameters being the literal for t=
he =
>>> 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();
>>> }
>> --Using Opera's revolutionary e-mail client: =
>> http://www.opera.com/mail/
>
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Re: [Teneo] EEnum attributes getting reset after a query [message #597077 is a reply to message #64822] |
Tue, 19 December 2006 01:32  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Update: This only happens to EEnums that have different values for thei=
r =
"name" and "literal" values. At least I have a work around....
On Tue, 19 Dec 2006 17:09:09 +1100, Stephen Egan <Stephen.Egan@csiro.au=
> =
wrote:
> 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 EEnu=
m =
> 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 to it's default! This is particularly curious as I have run a =
> query with one of the query parameters being the literal for the EEnum=
=
> that gets changed! I've included a snippet below. Any ideas as to wh=
at =
> 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();
> }
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Re: [Teneo] EEnum attributes getting reset after a query [message #597082 is a reply to message #64844] |
Tue, 19 December 2006 03:22  |
Eclipse User |
|
|
|
Hi Stephen,
Thanks for the extra info. This is a mismatch between Teneo and the way EMF handles enums (it
changed a while back).
Can you enter a bugzilla for this? There will be a solution in the next release.
gr. Martin
Stephen Egan wrote:
> Update: This only happens to EEnums that have different values for
> their "name" and "literal" values. At least I have a work around....
> On Tue, 19 Dec 2006 17:09:09 +1100, Stephen Egan
> <Stephen.Egan@csiro.au> wrote:
>
>> 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 to it's default! This is particularly curious as I have
>> run a query with one 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 =
>> 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 = InitSessionFactory.getCurrentSession();
>> session.beginTransaction();
>> RoadAuthorityDao dao = new RoadAuthorityDao();
>> RoadAuthority ra =
>> PartyRoleFactory.eINSTANCE.createRoadAuthority();
>> ra.setName("Mundubbera");
>> List<RoadAuthority> l = dao.findByExample(ra);
>> if (l.size() ==1) {
>> ra = l.get(0);
>> } else {
>> System.out.println("No RA for Mundubbera");
>> System.exit(-1);
>> }
>> account.setRoadAuthority(ra);
>> session.save(account);
>> session.getTransaction().commit();
>> session = InitSessionFactory.getCurrentSession();
>> session.beginTransaction();
>> UserAccount ua2 = (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();
>> }
>
>
>
> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] EEnum attributes getting reset after a query [message #597175 is a reply to message #64865] |
Tue, 19 December 2006 21:10  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Thanks very much Martin,
I've submitted bug number 168623
//Stephen
On Tue, 19 Dec 2006 19:22:20 +1100, Martin Taal <mtaal@elver.org> wrote:=
> Hi Stephen,
> Thanks for the extra info. This is a mismatch between Teneo and the wa=
y =
> EMF handles enums (it changed a while back).
> Can you enter a bugzilla for this? There will be a solution in the nex=
t =
> release.
>
> gr. Martin
>
> Stephen Egan wrote:
>> Update: This only happens to EEnums that have different values for =
>> their "name" and "literal" values. At least I have a work around....=
>> On Tue, 19 Dec 2006 17:09:09 +1100, Stephen Egan =
>> <Stephen.Egan@csiro.au> wrote:
>>
>>> 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 ge=
ts =
>>> reset back to it's default! This is particularly curious as I have =
=
>>> run a query with one of the query parameters being the literal for t=
he =
>>> 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();
>>> }
>> --Using Opera's revolutionary e-mail client: =
>> http://www.opera.com/mail/
>
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Goto Forum:
Current Time: Sun May 11 03:03:00 EDT 2025
Powered by FUDForum. Page generated in 0.05179 seconds
|