0

I am working with the com.j256.ormlite package.

My goal is to have a working database-file and a file the user can save with an UI-button to. To reach this goal I intent to track changes in the working file at the database abstraction layer and notify the user when he closes the program, that there is unsaved data.

How could I track if changes are made?

My first intuition is to write a decorator for the Dao Interface and wrap the Dao Creation in a single method, which uses my decorator.

The decorator could modify all update & delete methods. But the dao seems to support transactions and seems to be a complex and long interface.

How would you best solve my problem?

Gray
  • 108,756
  • 21
  • 270
  • 333
Jakob Alexander Eichler
  • 2,788
  • 3
  • 30
  • 44

1 Answers1

0

My first intuition is to write a decorator for the Dao Interface and wrap the Dao Creation in a single method, which uses my decorator.

This certainly would make sense as long as all access to the database is done through the DAO. I don't see why the transactions would complicate matters as long as used dao.callBatchTasks(...) which would call through your decorator.

Under the covers ORMLite uses 3 interfaces which represent the SQL database.

You could write proxies for these classes which are lower level.

Gray
  • 108,756
  • 21
  • 270
  • 333