Is there a way to run eclipselink as a commandline tool? Or as a jar file? I need to pass arguments and run it automatically so that it can generate the entities every time I change the db, or on every nightly build.
EclipseLink does not generate entity files. What are you generating the files from?
There are tools, such as Eclipse Dali (JPA) that can generate a Java object model from a database schema. They might support some kind of automation.
In general generating an object model is not normally the best idea. Normally the object model would be designed, base on the applications needs.
If you are generating the object model, what about the code that uses it, are you generating it to?
You might want to look at EclipseLink dynamic entity support.