Question: I've just recently started using hibernate and so I apologize if this is a stupid question.

I want to package some of my code into a module which different applications can then utilize.
For example, a package that handles sending SMS messages.
This package does some database work to get basic config data and then might do some transaction logging.
This will then be added to applications requiring SMS functionality.
The package would therefore require the calling application to contain the specific config and logging tables required by the package.

My problem is that in order to write the hibernate methods that get the config and do the logging it needs to know of the hibernate specific DOA objects. The problem is these objects are only generated when we create the specific application database mapping.

Answer: 
This is a late response, but I wanted to add my implementation of a timer. It is a threaded timer, and needs some work, with wrapping up mutexes and pthreads in their own classes (lack of RAII in that respect). It is also not cross platform since it uses the `gettimeofday()` method.

The code uses a timer that calls on a CallBack object. The entire source can be seen at

[`http://matthewh.me/playground/browser/branches/C%2B%2B/c%2B%2B_callbacks`](http://matthewh.me/playground/browser/branches/C++/c++_callbacks)
simple way to create a timer in c is to use sleep(time\_in\_seconds)

```
sleep(3); // waits for 3 seconds
doSomeJob();

```

you can also find few more code snippets for time conversations in various languages here(<https://unixtimer.com>)

if you need control on the timer and need to do customized task based on time, you can use clock() in "#include <time.h>"

```
int milli_sec = 0, trigger_time = 100; i_trigger = 5; /* trigger_time-> 100ms, i_trigger-> 5ms */
clock_t before = clock();

do {
  /*
   * Do something to busy the CPU just here while you drink a coffee
   * Be sure this code will not take more than `trigger_time` ms
   */

  clock_t difference = clock() - before;
  milli_sec = difference * 1000 / CLOCKS_PER_SEC;
  iterations++;
  if(milli_sec==i_trigger){
    // do something in async
  }
} while ( milli_sec < trigger_time );

printf("Time taken %d seconds %d milliseconds (%d iterations)\n",
  milli_sec/1000, milli_sec%1000, iterations);

  [1]: https://www.unixtimer.com/

```