DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCJPA-149
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Rolf Aden
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
DataNucleus API JPA

SingularAttribute.isOptional throws ArrayIndexOutOfBoundsException

Created: 29/Jul/11 05:13 PM   Updated: 01/Aug/11 05:13 PM   Resolved: 29/Jul/11 07:40 PM
Component/s: API
Affects Version/s: 3.0.0.m6
Fix Version/s: 3.0.0.release

File Attachments: 1. Zip Archive isOptionalTest.zip (2 kB)

Environment: windows 7


 Description  « Hide
Calling the method isOptional() on javax.persistence.metamodel.SingularAttribute throws a ArrayIndexOutOfBoundsException.

java.lang.ArrayIndexOutOfBoundsException: 0
at org.datanucleus.api.jpa.metamodel.SingularAttributeImpl.isOptional(SingularAttributeImpl.java:57)

You can reproduce it with the following persistent class.

@Entity
public class A {
@SuppressWarnings("unused")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@SuppressWarnings("unused")
private Boolean boolOpt;

@SuppressWarnings("unused")
@Basic(optional = false)
private boolean bool;

@SuppressWarnings("unused")
private Integer integerOpt;

@SuppressWarnings("unused")
@Basic(optional = false)
private int integer;
}


Rolf Aden added a comment - 29/Jul/11 05:16 PM
The issue can be reproduced using the attached test case.

Rolf Aden made changes - 29/Jul/11 05:16 PM
Field Original Value New Value
Attachment isOptionalTest.zip [ 11481 ]
Andy Jefferson added a comment - 29/Jul/11 07:40 PM
SVN trunk works. thx

Andy Jefferson made changes - 29/Jul/11 07:40 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.release [ 11072 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Aug/11 05:13 PM
Status Resolved [ 5 ] Closed [ 6 ]