· Eclipse
· OpenAcess Server
· OpenAccess JDBC driver
· Hibernate package
1. Create a java project in eclipse and add the attached application. Add the OpenAccess JDBC driver (oajc.jar) in build path to connect to the OpenAccess Server.
Add all the required Hibernate jars which can be downloaded from http://hibernate.org/. Your Application will looks like as shown below
2. The sample dialect class contains definition of data types and scalar functions supported by OpenAccess. As shown below, this dialect class
should be the part of hibernate package “org.hibernate.dialect “.
3. Define the OpenAccess server configuration details and dialect class name in hibernate.cfg.xml file. Hibernate requires to know in advance where
to find the mapping information that defines how your Java classes relate to the database tables. It also requires a set of configuration settings
related to database and other related parameters. All such information is usually supplied in this XML file.
Please note that property “hbm2ddl.auto” is set as “create”, which will recreate the Emp table every time you runs the application,
You can modify it according to your needs.
4. This application is ready to run and can be triggered from “HibernateMain.java”. File “input1.sql” contains few examples of select queries to execute
via hibernate HQL and file “input2.sql” contains few examples of scalar functions defined in the OpenAccessDialect class. These files will execute against
your configured OpenAccess data source and generates the corresponding output files.
The mentioned steps to setup Hibernate application are applicable to both OpenAccess 7.2 and OpenAccess 8.0
Thanks,
Prashant
Thanks Prashant