ankur jadiya

Greenhorn
+ Follow
since Feb 15, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ankur jadiya

Hi
I am trying to implement quartz persistent job using spring and new to this . I have implemented the Job interface in class SimpleQuartzJob. When I run the main program , Job is persisting in the the database but the execute(JobExecutionContext context) method of SimpleQuartzJob is not triggering at the scheduled time. I am not able to figure why this is happening?



PersistableCronTriggerFactoryBean



AutowiringSpringBeanJobFactory



spring-quartz-jdbc.xml



quartz.properties



main Function

5 years ago
my requirement is when i delete the parent ,child should not be deleted but instead of deleting child,one of the child column department_ID which is foreign key must be update with some value , say one department(Parent Table) contains many employee and employee(child Table) table have Department_ID as a foreign key column .The problem i m facing when i delete the parent table nothing is reflected on child cause i have make updatable=false if i will make it true then on deleting parent ,child column is set to null or if i update the parent then also child Department_Id column set to null which is violating the requirement so that's why i make it false .I don't want child to be update when the parent make any changes only changes should reflected on delete operation ,only on one column. Please help me what should i do? thanks

This is my Praent Table(Department code)


This is child table Employee code

Deepak Nn wrote:Hi Everyone,

I am a beginner in hibernate and I am trying to write my first application but I am getting an error saying "Could not parse configuration: hibernate.cfg.xml" and I have been try to resolve this from last 2 days but with no success

Can anyone please help me in resolving this issue. Thanks in advance

my hibernate.cfg.xml file

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="connection.url">jdbc:sqlserver://isvdbd3:1119</property>
<property name="connection.username">digite</property>
<property name="connection.password">marksession</property>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
<mapping resource="employee.hbm.xml"/>
</session-factory>

</hibernate-configuration>

I am using MS sql as my database


Error stack trace is as below

Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
at com.javatpoint.mypackage.StoreData.main(StoreData.java:13)
Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481)
... 2 more

Someone please let know

Regards,
Deepak


Ankurjadiya wrote: hi deepak
can you check your dialect for my sql database dialect is different you are using Derby Dialect instead of SQLServerDialect you can try this

ankur wrote:Hi Anayonkar Shivalkar,

Thanks for replying as you know this is my first time can you tell if question related to particular topic how to ask question on that topic forum

This problem is related to hibenate and this is my first time to ask the question in this forum if any mistakes on asking question please tell me so that i can improve style of asking question thanks.
My problem is that when i am performing delete operation on parent table parent is deleted smoothly but in child table, update query is running.There is one-to-many relation exist in parent and child table
where Employee Table is parent and Project table is child table
when executing the program output is showing like this

output

Hibernate: update employee_project set employeeNumber=null where employeeNumber=?
Hibernate: delete from employee where EMPLOYEE_NUMBER=?



Employee pojo

}
and this is my Employee.hbm.xml



and this is my project.hbm.xml




and the logic is
of deleting is