Win a copy of Head First Android this week in the Android forum!

Nanda Suraj

Greenhorn
+ Follow
since May 04, 2005
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 Nanda Suraj

hi Henrique ,

I have got the same exception. I have given both the mapping inside the hibernate.cfg.xml. But it still shows the exception :

An association from the table refers to an unmapped class: java.lang.ExceptionInInitializerError

have any idea ?
I got it right. Thanks for the help.

I gave wrong type in the hbm.xml file. Instead of long , i gave integer.

Not its working and stored in the table.
Yes, you are correct. When I printed the exception I got :
" identifier of an instance of events.Event was altered from 1 to 1 "

I don't understand why this exception occures ?

Please help me ..

Thanks,
Hi ,

I am a newbie to hibernate. I desperately need to sort a simple example.

I am using oracle as a database. I am trying to work out the example (Event) specified in www.hibernate.org. I cleared of exceptions or errors. But the values giver is not inserting into the table.

The hbm.xml file I wrote is as :

<hibernate-mapping>
<class name="events.Event" table="EVENTS">
<id name="id" column="EVENT_ID" type="integer" unsaved-value="0">
<generator class="increment"/>
</id>
<property name="dt" type="timestamp" column="EVENT_DATE"/>
<property name="title" column="TITLE"/>
</class>
</hibernate-mapping>

and the class that does the transactions is :

/*
* EventManager.java
*
* Created on 12 January 2006, 10:33
*/

package events;

import org.hibernate.Session;

import java.util.Date;
import java.util.List;
import util.HibernateUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class EventManager {
private static Log log = LogFactory.getLog(HibernateUtil.class);
public static void main(String[] args) {

EventManager mgr = new EventManager();
long id = 101;
Event eve = new Event();
System.out.println("INSIDE LIST... ");
if (args[0].equals("store")) {

mgr.createAndStoreEvent("My Event", new Date());
}
else if (args[0].equals("list")) {
List events = mgr.listEvents();
for (int i = 0; i < events.size(); i++) {
Event theEvent = (Event) events.get(i);
System.out.println("Event: " + theEvent.getTitle() +
" Time: " + theEvent.getDt());
}
}
HibernateUtil.getSessionFactory().close();
}

private void createAndStoreEvent(String title, Date theDate) {
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

Event theEvent = new Event();

theEvent.setTitle(title);
theEvent.setDt(theDate);

session.save(theEvent);
session.update(theEvent);
System.out.println("event id : "+theEvent.getId());
System.out.println("event title : "+theEvent.getTitle());
session.getTransaction().commit();
session.connection().commit();

//session.connection().createStatement().execute("SHUTDOWN");
}catch(Exception e){}
}


private List listEvents() {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();

List result = session.createQuery("from Event").list();

session.getTransaction().commit();

return result;
}

}

Anybody have an idea why the values not storing into ?

Thanks,
Hi,

I attended an interview and they asked me :

* who does the requirement specification ?
* how do you start coding the project ?
* how do you design the project for coding ? etc ..

Actually in our company there is no specific structure ..means there is a project manager, he/she will write the requiremnt spec, which includes screens and explains each field of the csreen. thats all. then we get the databse from a dba. then we understand what are all the classes according to that data model, then start coding directly...am not sure what method is this...so am confused when an interviewer asks about this...

please anyone could help me in this ?


I have another one in near future ....so please help me out.

Thanks in advance.

[ June 13, 2005: Message edited by: Nanda Suraj ]
[ June 13, 2005: Message edited by: Nanda Suraj ]
16 years ago
Thanks very much Christopher, I got it.

Thank you very much for your reply.

Nanda.
16 years ago
Sorry Christopher, didn't get your idea. Could you please explain bit more ?


It will be a great healp if you could explain bit more clear.

Nanda.
16 years ago
Hi,

In my code, I have 3 buttons : save, signoff and cancel. And also I have 2 radio buttons : client and customer. When I press customer radio button, the signoff button should be disabled. How can I do that ? Do any one have an idea please.

For the buttons I use struts html:submit. And I haven't used any business logic on the JSP screen.

Please give me a solution as soon as possible.

Thanks,
Nanda.
16 years ago