Skip to content

RoboSpring OrmLite Integration

dthommes edited this page Sep 12, 2014 · 1 revision

Since version 1.0.5 there is a preliminary OrmLite integration support.

For OrmLite please consult: http://ormlite.com/

Here is a short example how to configure OrmLite with RoboSpring:

<bean class="org.robospring.ormlite.android.DaoFactoryAndroidImpl">
	<property name="databaseName" value="data.db" />
	<property name="entityClasses">
		<value>org.remoteui.client.favorites.Favorite</value>
	</property>
	<property name="initialEntities">
		<list>
			<bean class="org.remoteui.client.favorites.Favorite" p:name="RemoteUI Demo"
				p:address="ws://remoteui.mi.hdm-stuttgart.de:443/rui" p:mode="websocket" />
			<bean class="org.remoteui.client.favorites.Favorite" p:name="RemoteUI Demo (local)"
				p:address="ws://192.168.0.108:8080/RemoteUI-WebDemo/rui" p:mode="websocket" />
		</list>
	</property>
</bean>

And in your activity you can then retrieve the DAOs from this factory like this:

private Dao<Favorite, Long> favoriteDao;

@Autowired
public void setFactory(DaoFactory factory) throws SQLException {
	favoriteDao = factory.getDao(Favorite.class);
}

Please note, that database versioning is not yet really supported. On upgrade, the database will be dropped and recreated.

Clone this wiki locally