Home » Modeling » EMF » [CDO/Hibernate] Problem with Enum Attributes
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941082 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941086 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941091 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941099 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941104 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO/Hibernate] Problem with Enum Attributes [message #941111 is a reply to message #940428] |
Fri, 12 October 2012 07:47 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Christoph,
I can't really explain this... I have a testcase for this also, I adapted it a little to really check. See the attached
code look for VAT7 and VAT15 to see the enums.
gr. Martin
On 10/11/2012 06:21 PM, Christoph Keimel wrote:
> Hello
>
> I am having a problem with enum attributes.
>
> Using this test model:
> enum SomeEnum {
> FIRST
> SECOND
> THIRD
> }
>
> class ElementWithEnum {
> String[1] name
> SomeEnum[1] some
> }
> ... running this code ...
> public void execute(IRepoService repo) {
> CDOTransaction transaction = repo.openTransaction();
> try {
> CDOResource res = transaction.getRootResource();
>
> ElementWithEnum element = EmTracFactory.eINSTANCE.createElementWithEnum();
> element.setName("Test element " + res.getContents().size());
> logger.info("some (Default): {}", element.getSome());
>
> SomeEnum toSet = SomeEnum.SECOND;
> element.setSome(toSet);
> logger.info("some (After Set): {}", element.getSome());
>
> res.getContents().add(element);
> transaction.commit();
> logger.info("some (After Commit): {}", element.getSome());
>
> Assert.isTrue(toSet == element.getSome());
> } catch (CommitException e) {
> logger.error("CommitException: {}", e);
> } finally {
> transaction.close();
> }
> }
> where IRepoService is just a simple wrapper managing the connection to the server with a single CDOSession.
>
> I get the following log output:
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (Default): FIRST
> 18:13:41.353 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Set): SECOND
> 18:13:41.384 INFO d.e.e.c.t.h.TestInsertElementWithEnum - some (After Commit): FIRST
> and the Assert.isTrue fails because the attribute some now has its default value again.
>
> This seems so basic, that I suspect that I am missing something realy fundamental, but I have no idea what it could be.
> Please help! (again :))
>
> Greetings
> Christoph
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
| | | |
Goto Forum:
Current Time: Thu Sep 19 08:36:09 GMT 2024
Powered by FUDForum. Page generated in 0.04799 seconds
|