Hi All!
I am using Hibernate springs and Struts to build my application!
I have two Master tables-"Technology" and "Skills". Associate with each technology there are many skills, so as to make it one to many! I need to take data from these two tables and populate a drop down menu- First the Technology and when the technology drop down changes the skills menu gets populate. Now I have to save the entire form which contains additional fields too! When the technology changes I save the 'technologyId' in the session and refresh the page. Then I save the 'skillId' too when the skill drop down changes, along with the 'technologyId'.
Having done this I need to fill other fields and submit the form!
However when I am submitting the form I am getting the IllegalArgumentException in class Exception!
My .hbm files are as:
Employee_Skills:
<?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
package="com.tavant.resume.app.employeeSkills.domain">
<class lazy="false" name="EmployeeSkills" table="employee_skill">
<id name="employeeSkillId" column="EMPLOYEE_SKILL_ID" type="integer">
<generator class="increment" />
</id>
<property name="years" column="YEARS" type="integer" />
<property name="months" column="MONTHS" type="integer" />
<property name="description" column="DESCRIPTION" type="string" />
<many-to-one name="technologyId" class="com.tavant.resume.app.technology.domain.Technology" column="TECHNOLOGY_ID"></many-to-one>
<many-to-one name="skillId" class="com.tavant.resume.app.skills.domain.Skills" column="SKILL_ID"></many-to-one>
<many-to-one name="employeeId" class="com.tavant.resume.app.user.domain.User" column="EMPLOYEE_ID"></many-to-one>
</class>
</hibernate-mapping>
=========================================
Skills
<?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
package="com.tavant.resume.app.skills.domain">
<class lazy="false" name="Skills" table="skill">
<id name="skillId" column="SKILL_ID" type="integer">
</id>
<property name="skill" column="NAME" type="string" />
<many-to-one name="technology" class="com.tavant.resume.app.technology.domain.Technology" column="TECHNOLOGY_ID">
</many-to-one>
</class>
</hibernate-mapping>
===================
Technology:
<?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
package="com.tavant.resume.app.technology.domain">
<class lazy="false" name="Technology" table="technology">
<id name="technologyId" column="TECHNOLOGY_ID" type="integer">
</id>
<property name="technology" column="NAME" type="string" />
</class>
</hibernate-mapping>
===================
In my MySql the table
CREATE TABLE `employee_skill` (
`EMPLOYEE_SKILL_ID` int(11) NOT NULL auto_increment,
`YEARS` int(11) default NULL,
`MONTHS` int(11) default NULL,
`EMPLOYEE_ID` int(11) default NULL,
`TECHNOLOGY_ID` int(11) default NULL,
`SKILL_ID` int(11) default NULL,
`DESCRIPTION` varchar(100) default NULL,
PRIMARY KEY (`EMPLOYEE_SKILL_ID`),
KEY `FK_employee_skill_1` (`SKILL_ID`),
KEY `FK_employee_skill_3` (`EMPLOYEE_ID`),
KEY `TECHNOLOGY_ID` (`TECHNOLOGY_ID`),
CONSTRAINT `employee_skill_ibfk_1` FOREIGN KEY (`TECHNOLOGY_ID`) REFERENCES `technology` (`TECHNOLOGY_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_employee_skill_1` FOREIGN KEY (`SKILL_ID`) REFERENCES `skill` (`SKILL_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_employee_skill_3` FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES `employee` (`EMPLOYEE_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `skill` (
`SKILL_ID` int(11) NOT NULL auto_increment,
`NAME` varchar(50) default NULL,
`TECHNOLOGY_ID` int(11) default NULL,
PRIMARY KEY (`SKILL_ID`),
KEY `FK_skill_1` (`TECHNOLOGY_ID`),
CONSTRAINT `FK_skill_1` FOREIGN KEY (`TECHNOLOGY_ID`) REFERENCES `technology` (`TECHNOLOGY_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `technology` (
`TECHNOLOGY_ID` int(11) NOT NULL auto_increment,
`NAME` varchar(50) default NULL,
PRIMARY KEY (`TECHNOLOGY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
===================================
The Exception is:
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred calling getter of com.tavant.resume.app.technology.domain.Technology.technologyId; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.tavant.resume.app.technology.domain.Technology.technologyId
2006-08-30 13:13:02,998 INFO [STDOUT] org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.tavant.resume.app.technology.domain.Technology.technologyId
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:119)
at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:103)
at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2944)
at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2705)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.engine.ForeignKeys$Nullifier.isNullifiable(ForeignKeys.java:137)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:69)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:47)
i am a newbie to this stuff and learning things! Pls tell me where I am wrong!
|