简体   繁体   中英

Simple pojo persistence without database

I have a very simple web project, which need to just persistence some "users", each one just have a few fields("username", "password").

Now I persistent them into a database, but I think it's too heavy.

I wonder if there are some easy ways to persistent them without a database. It's great just need to save pojos directly.


UPDATE

To save them in a file directly(like serialization, properties file) is easy, but not easy with CRUD. That means, when I get a specified user, I have to load them, then check the username one by one. When I update or delete one, I need to load all and save all.

I hope something like db4o , but with a good licence(not GPL nor commercial). The performance is not important here.

You could use the built-in serialization for Java or have a look at some of the XML serializers, like simple .

SQLite might be a suitable alternative to a client/server type database, but use from Java is a little awkward, as some native libs are required.

Using Properties file is another solution, http://download.oracle.com/javase/tutorial/essential/environment/properties.html But note that you're storing passwords, you might need to encrypt them

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM