pardom-zz / Ollie

Compile-time active record ORM for Android
Apache License 2.0
417 stars 38 forks source link

[question] where should I initialize the Ollie? #61

Open PerfectCarl opened 9 years ago

PerfectCarl commented 9 years ago

I gathered that the following code must be called:

Ollie.with(context)
    .setName(DB_NAME)
    .setVersion(DB_VERSION)
    .setLogLevel(LogLevel.FULL)
    .setCacheSize(CACHE_SIZE)
    .init();

What is the best place? The application initialization?

How should I set CACHE_SIZE ?

note: an android sample would be a huge help to get things started.

markini commented 9 years ago

The onCreate() of the application is a good place. Just go with Ollie.DEFAULT_CACHE_SIZE for starters.

PerfectCarl commented 9 years ago

Thanks!

The README.md should be updated using that info.

Also a bit off topic, how the call to default methods in

Select.columns("COUNT(*)").from(Note.class).observableValue(Integer.class)
    .subscribe(count -> {
        // do stuff with count
    });

are supposed to work for Android? Is java8 allowed for Android?