| Summary: | Problems running example "org.eclipse.emf.teneo.hibernate.examples" | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | tenor <shriani.kr> |
| Component: | Teneo | Assignee: | Martin Taal <mtaal> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
tenor
Sorry, I am going to reject this issue. The problems you are having seem to be basic java project setup issues which you should be able to solve as a java programmer. gr. Martin I am trying to modify my project code on the lines of
package teneotest;
import java.util.Properties;
import orders.Customer;
import orders.OrdersPackage;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;
public class EmfTeneoHibernate {
@SuppressWarnings("deprecation")
public static void main(String[]args)
{
HbDataStore hbds = (HbDataStore)HbHelper.INSTANCE.createRegisterDataStore("MyDb");
//HbDataStore hbds = (HbDataStore)HbHelper.INSTANCE.
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "oracle.jdbc.OracleDriver");
props.setProperty(Environment.URL, "jdbc:oracle:thin:@158.234.90.17:1521:dev01");
props.setProperty(Environment.USER, "kumara");
props.setProperty(Environment.PASS, "password");
//props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
props.setProperty(Environment.DIALECT, org.hibernate.dialect.OracleDialect.class.getName());
props.setProperty(Environment.SHOW_SQL, "true");
hbds.setProperties(props);
hbds.setEPackages(new EPackage[]{OrdersPackage.eINSTANCE});
hbds.initialize();
SessionFactory sessionFactory = hbds.getSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
//tx.begin();
Customer customer = OrdersPackage.eINSTANCE.getOrdersFactory().createCustomer();
customer.setCode("0023485");
session.save(customer);
System.out.println("The generated XML is : "+ hbds.getMappingXML().toString());
tx.commit();
session.close();
System.out.println("The customer details are :-- " + customer.getCode());
}
}
This code has worked and wanted to modify it using our domain objects but i notice two things
1)hbds.setEPackages...
2) OrdersPackage.eINSTANCE.getOrdersFactory
Whic are missing so far in our EMF generated model , all i want to know
are Epackage and Factory are mandatory as even in the link below it says about registering for Epackage so that Teneo can work
ie
A number of EPackages have to be registered with Teneo to persist.
Plz reply and help out. Appreciate it.
Thanks.
|