351 words

Issue #59 - ArrayIndexOutOfBoundsException with enhanced Entity

BugVersion: 2.2.8Priority: NormalStatus: FixedReplies: 7
#1
2011-07-25 12:37

Hi!

We have an two entities, the first one is something like:

@Embeddable
class TestEmbed
{...}

and the second one:

@Entity
class TestEntity
{
private TestEmbed myEmbed = null;

public TestEmbed getMyEmbed()
{
  if (myEmbed == null)
  {
     myEmbed = new TestEmbed();
  }
  return myEmbed;
}

Now when we load a TestEmbed class from the object database and do access the myEmbed property the first time with getMyEmbed() then we get an ArrayIndexOutOfBoundsException within here:

MMM.J(int) line: 602
ENT.beforeModifyEmbedded(int) line: 1007
EMT.beforeModifyMember(int) line: 90
TestEntity.__odbSet_myEmbed(TestEntity, TestEmbed) line: 1 (out of synch)
TestEntity.getMyEmbed() line: 71 (out of synch)

quasado
quasado's picture
Joined on 2011-04-30
User Post #12
#2
2011-07-25 13:35

ok it is getting worse.. I do get a Nullpointer exception in the same class though this time during a simple string-property setter???

 

Caused by: java.lang.NullPointerException
at com.objectdb.o.ENT.beforeModifyEmbedded(ENT.java:1011)
at com.objectdb.o.EMT.beforeModifyMember(EMT.java:90)
at ...

quasado
quasado's picture
Joined on 2011-04-30
User Post #13
#3
2011-07-25 18:43

The stack trace has not been produced by the last ObjectDB version.

Which ObjectDB version are you using (probably not 1.0.4 as filled for this issue)?

Could you try the last build?

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #478
#4
2011-07-26 06:36

hi,

 

yes, my fault sorry. I've been using 2.2.8 as well as I've tried it with 2.2.8_06 and it has happened with both.

The weird thing is that it doesn't happen always...!??

 

Alex

quasado
quasado's picture
Joined on 2011-04-30
User Post #14
#5
2011-07-26 07:34

hi!

ok I did some more testing. I do get a lot of different errors (NullPointerException, Attempting to modify a primary key of a managed object etc etc.). However It seems to happen only with an embeddable entity embedded within another embeddable entity like:

 

@Embeddable
class Embed_A {}

@Embeddable
class Embed_B { private Embed_A embedA; .. }

@Entity
class MyEntity { private Embed_B embedB; ... }

Removing embedA from Embed_B seems to work fine though as soon as adding it again, things go crazy during commit and merging!??

 

quasado
quasado's picture
Joined on 2011-04-30
User Post #15
#6
2011-07-26 07:36

Hmm getting closer.. it seems that when I do remove an enum property from Embed_A it works as well so it looks more or less that the enum in Embed_A causes issues though its a pretty basic thing:

enum Test
 { APPLE, PIE }

class EmbedA { private Test test; ... }

quasado
quasado's picture
Joined on 2011-04-30
User Post #16
#7
2011-07-26 08:30

hi,

ok, one issue was the enum for which I use and store a string now.

but it seems the second issue is really having an embeddable within an embeddable as I do still get the issues that I wrote in the first posting..

alex

quasado
quasado's picture
Joined on 2011-04-30
User Post #17
#8
2011-08-10 21:48

This bug (in managing nested embedded objects) was fixed in version 2.2.9.

Thank you for your report.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #515

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel