Neodatis V2 Api Example
import java.util.Date;
 
import org.neodatis.odb.NeoDatis;
import org.neodatis.odb.NeoDatisConfig;
import org.neodatis.odb.ODB;
import org.neodatis.odb.Objects;
 
import com.neodatis.odb.plugin.engine.berkeleydb.NeoDatisBerkeleyDBPlugin;
 
/**
 * @author olivier
 *
 */
public class SimpleTest {
 
    public static void main(String[] args) {
 
        String baseName = "test.neodatis";
 
        // Creates the database (data will be saved in the test.neodatis file
        ODB odb = NeoDatis.open(baseName);
 
        // Stores a new player
        odb.store(new Player("Luane", new Date(), new Sport("Squash")));
 
        // Closes the database
        odb.close();
 
        // re opens the database to get objects
        odb = NeoDatis.open(baseName);
 
        // Gets all the players
        Objects<Player> players = odb.query(Player.class).objects();
 
        // display results
        while(players.hasNext()){
            System.out.println(players.next());
        }
    }
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License