So you're looking into having a batch process type of application, which runs through all records in LDAP and adds them into the database if not already there?
Here's the simplest approach I can think of (unless your LDAP directory has some LDAP-to-database synchronization feature):
1) Get a list of all user records from LDAP
2) Iterate through the list in your
Java code, and for each "User" object do the following:
2.1) Try to SELECT from the database based on the LDAP user's username
2.2) If not found from the database, make an INSERT. If found, skip to next user.