ahmetalpbalkan/orman — Issue #39: Android - MappingSessionAlreadyStartedException
Author: ragunathjawahar
Created: 2011-11-27 14:56:27+00:00
State: open

I start the Mapping Session in my Activity's **onCreate** method. Once I back out of the application and restart it once again I get the following exception:

11-27 17:55:53.448: E/AndroidRuntime(754): Caused by: org.orman.mapper.exception.MappingSessionAlreadyStartedException: Mapping session has already been started. Do not use start method more than once.

The app then crashes, but the next time I open the app, it works fine.

```Java
public static void initOrmanMappingSession(Class[] entityClasses, Database database) {
System.gc();

MappingSession.getConfiguration().setCreationPolicy(SchemaCreationPolicy.CREATE_IF_NOT_EXISTS);
MappingSession.registerDatabase(database);
for(Class clazz : entityClasses) {
MappingSession.registerEntity(clazz);
}

MappingSession.startSafe();
}
```