-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: getting a java.lang.reflect.InvocationTargetException help!
PostPosted: Fri May 09, 2014 5:50 pm 
Newbie

Joined: Fri May 09, 2014 5:13 pm
Posts: 1
Anyone know what im doing wrong? Ive attached the whole thing - can anyone help? its not working...output is as follows:
May 09, 2014 5:43:14 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
May 09, 2014 5:43:14 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.4.Final}
May 09, 2014 5:43:14 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
May 09, 2014 5:43:14 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
May 09, 2014 5:43:14 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
May 09, 2014 5:43:14 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
May 09, 2014 5:43:14 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
May 09, 2014 5:43:14 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: deptjoin.hbm.xml
May 09, 2014 5:43:14 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
May 09, 2014 5:43:14 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: emp.hbm.xml
May 09, 2014 5:43:14 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
May 09, 2014 5:43:14 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
May 09, 2014 5:43:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
May 09, 2014 5:43:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 10
May 09, 2014 5:43:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
May 09, 2014 5:43:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:XE]
May 09, 2014 5:43:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=hr, password=****}
May 09, 2014 5:43:15 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.OracleDialect
May 09, 2014 5:43:15 PM org.hibernate.dialect.Oracle9Dialect <init>
WARN: HHH000063: The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
May 09, 2014 5:43:15 PM org.hibernate.dialect.OracleDialect <init>
WARN: HHH000064: The OracleDialect dialect has been deprecated; use Oracle8iDialect instead
May 09, 2014 5:43:15 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
May 09, 2014 5:43:15 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
May 09, 2014 5:43:15 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
May 09, 2014 5:43:15 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
May 09, 2014 5:43:15 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000102: Fetching database metadata
May 09, 2014 5:43:15 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000396: Updating schema
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000261: Table found: HR.DEPARTMENTS
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000037: Columns: [manager_id, department_id, department_name, location_id]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000108: Foreign keys: [dept_loc_fk, dept_mgr_fk]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000126: Indexes: [dept_location_ix, dept_id_pk]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000261: Table found: HR.EMPLOYEES
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000037: Columns: [first_name, hire_date, commission_pct, phone_number, email, manager_id, department_id, deparment_id, last_name, salary, employee_id, job_id]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000108: Foreign keys: [emp_dept_fk, emp_job_fk, emp_manager_fk, fk4351ff65e1e01ff6]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000126: Indexes: [emp_job_ix, emp_department_ix, emp_manager_ix, emp_emp_id_pk, emp_email_uk, emp_name_ix]
May 09, 2014 5:43:16 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
Hibernate: select department0_.DEPARTMENT_ID as DEPARTMENT1_0_0_, department0_.DEPARTMENT_NAME as DEPARTMENT2_0_0_, department0_.LOCATION_ID as LOCATION3_0_0_, department0_.MANAGER_ID as MANAGER4_0_0_ from DEPARTMENTS department0_ where department0_.DEPARTMENT_ID=?
Hibernate: select employees0_.DEPARMENT_ID as DEPARMENT12_0_1_, employees0_.EMPLOYEE_ID as EMPLOYEE1_1_, employees0_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees0_.FIRST_NAME as FIRST2_1_0_, employees0_.LAST_NAME as LAST3_1_0_, employees0_.EMAIL as EMAIL1_0_, employees0_.PHONE_NUMBER as PHONE5_1_0_, employees0_.HIRE_DATE as HIRE6_1_0_, employees0_.JOB_ID as JOB7_1_0_, employees0_.SALARY as SALARY1_0_, employees0_.COMMISSION_PCT as COMMISSION9_1_0_, employees0_.MANAGER_ID as MANAGER10_1_0_, employees0_.DEPARTMENT_ID as DEPARTMENT11_1_0_ from EMPLOYEES employees0_ where employees0_.DEPARMENT_ID=?
0
Department Details ==> Sales



Client :

package com.orm.client;
import java.util.HashSet;
import java.util.Set;
import com.orm.dao.EmployeeDAO;
import com.orm.po.DepartmentJoin;
import com.orm.po.Employees;

public class EmployeeClient {
public static void main(String[] args) {
displayDepartmentDetails(80);
}


public static void displayDepartmentDetails (int deptId)
{
EmployeeDAO dao = new EmployeeDAO();

DepartmentJoin dept = dao.getDepartmentDetails(deptId);

System.out.println(" Department Details ==> " + dept.getDeptName());

Set<Employees> empSet = dept.getEmployees ();

for (Employees emp: empSet)
{
System.out.print(" Emp ID: " + emp.getEmployeeId() + "\t" +emp.getFirstName()+"\n" + emp.getLastName());
}
}


package com.orm.dao;
import java.util.Set;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.orm.po.DepartmentJoin;
import com.orm.po.Employees;
import com.orm.util.HibernateUtil;

public class EmployeeDAO {
public DepartmentJoin getDepartmentDetails (long deptId)
{
SessionFactory sf = HibernateUtil.getSf();
Session session = sf.openSession();
DepartmentJoin dept = (DepartmentJoin)session.get(DepartmentJoin.class, new Long (deptId));
//dept.setEmployees(dept.getEmployees());
Set <Employees> eset=dept.getEmployees();
System.out.println(eset.size());
session.close();
return dept;
}


package com.orm.po;
import java.util.Set;
public class DepartmentJoin {
private long deptNo;
private String deptName;
private int managerID;
private int locID;
private Set<Employees> employees;
public long getDeptNo() {
return deptNo;
}
public void setDeptNo(long deptNo) {
this.deptNo = deptNo;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public int getManagerID() {
return managerID;
}
public void setManagerID(int managerID) {
this.managerID = managerID;
}
public int getLocID() {
return locID;
}
public void setLocID(int locID) {
this.locID = locID;
}
public Set<Employees> getEmployees() {
return employees;
}
public void setEmployees(Set<Employees> employees) {
this.employees = employees;
}

}

package com.orm.po;

import java.sql.Date;

import com.orm.po.DepartmentJoin;

public class Employees {

private int employeeId;
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
private Date hireDate;
private String jobId;
private double salary;
private double commision;
private int managerId;


private DepartmentJoin dept;
public int getEmployeeId() {
return employeeId;
}

public void setEmployeeId (int employeeId) {
this.employeeId = employeeId;
}


public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

public Date getHireDate() {
return hireDate;
}

public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}

public String getJobId() {
return jobId;
}

public void setJobId(String jobId) {
this.jobId = jobId;
}

public double getSalary() {
return salary;
}

public void setSalary(double salary) {
this.salary = salary;
}

public double getCommision() {
return commision;
}

public void setCommision(double commision) {
this.commision = commision;
}

public int getManagerId() {
return managerId;
}

public void setManagerId(int managerId) {
this.managerId = managerId;
}


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.orm.po.Employees" table="EMPLOYEES">
<id name="employeeId" type="int" column="EMPLOYEE_ID" >
<generator class="assigned"/>
</id>

<property name="firstName">
<column name="FIRST_NAME"/>
</property>

<property name="lastName">
<column name="LAST_NAME"/>
</property>

<property name="email">
<column name="EMAIL"/>
</property>

<property name="phoneNumber">
<column name="PHONE_NUMBER"/>
</property>

<property name="hireDate">
<column name="HIRE_DATE"/>
</property>

<property name="jobId">
<column name="JOB_ID"/>
</property>

<property name="salary">
<column name="SALARY"/>
</property>

<property name="commision">
<column name="COMMISSION_PCT"/>
</property>

<property name="managerId">
<column name="MANAGER_ID"/>
</property>

<many-to-one name="dept" column="DEPARTMENT_ID" not-null="true" lazy="false"/>

</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.orm.po.DepartmentJoin" table="DEPARTMENTS">

<id name="deptNo" type="long" column="DEPARTMENT_ID">
<generator class="assigned"/>
</id>

<property name="deptName" column="DEPARTMENT_NAME"/>
<property name="locID" column="LOCATION_ID"/>
<property name="managerID" column="MANAGER_ID"/>


<set name="employees" cascade="all" inverse="true" lazy="false">
<key column="DEPARMENT_ID"/>
<one-to-many class="com.orm.po.Employees"/>
</set>


</class>

</hibernate-mapping>


my cfg file:
<!-- Mapping files -->
<mapping resource="deptjoin.hbm.xml"/>
<mapping resource="emp.hbm.xml"/>


Top
 Profile  
 
 Post subject: Re: getting a java.lang.reflect.InvocationTargetException help!
PostPosted: Wed May 21, 2014 5:36 pm 
Newbie

Joined: Thu Mar 28, 2013 11:06 am
Posts: 8
I've not really figured out why you get it, because as I got from Wikipedia, oracle use this data format in his DB.

maybe try to disable this with:
hibernate.jdbc.lob.non_contextual_creation=true

best regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.