Menu

#193 Cannot store objects with Enum member

V2 beta
open
nobody
engine (145)
5
2012-02-13
2012-02-13
_ryan
No

When i try to store an object that has an enum member type, neodatis throws an exception. I believe this works ok in 1.9 latest, but not in 2.2 latest. Use the following code to reproduce error:

import org.neodatis.odb.NeoDatis;
import org.neodatis.odb.ODB;
import org.neodatis.odb.Objects;

public class EnumTest {

public enum Color {BLUE, RED, GREEN};
public static final String FILENAME = "test.db";
public class Car {
Color _model = Color.RED;
}

public static void main(String[] args)
{
new File(FILENAME).delete();

EnumTest test = new EnumTest();

ODB odb = NeoDatis.open(FILENAME);
odb.store(test.new Car());
odb.close();

ODB odb2 = NeoDatis.open(FILENAME);
Objects<Car> cars = odb2.query(Car.class).objects();

for (Car c : cars)
{
System.out.println(c.toString());
}

}
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.