shalindra Singh Suryvanshee

Greenhorn
+ Follow
since Aug 05, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by shalindra Singh Suryvanshee

are you using Spring along with Hibernate here, if yes, can you please paste the code of applicationContext.xml.
Actually If the association is lazy loaded and the Session has been closed then this won't work. You either need to eagerly load the association or reattach the entity to the Session before trying to lazy load.
try out with following lines of code -

Hi Hernan!

you should be able to resolve your problem with the code I attached -


Here there are following things which need attention -

1. please observe last two line. both are written for student_country column
2. getter and setter method should be present for both 'country' and 'studentCountry' property in Student DTO.
3. you should use 'studentCountry' property to create criteria (as you already doing).
Hi Hernan!

I would like to indicate following things from your code -
1. error thrown indicate that your application is not able to pick the correct driver jar file. Sometimes this could be the problem with Tomcat. Can you please put the driver jar file in WEB-INF/lib (application library) instead of tomcat lib (server library).
2. I feel you would not like to save OR update country while updating records in Student table. I am not sure is required ?
3. I am not very sure how to do the same using annotation, but in .hbm file I would write in following way -

you should notice of use of many-to-many node and property node for country.

Let me know if you have any doubt .
Best books are -
1. hibernate_reference
2. Manning_-_Hibernate_In_Action

you directly go to hibernate.org and get the complete reference.
following code should work in your case -

for more detail of how and why, please go through the following link -
Capture of ?" Compile error, what does it mean?

Thanks Rob, but how serialize will work here?



To make your serialize work, you may over-ride readObject() and writeobject() method which should only read and write only updated keys and values from HashMap.
13 years ago
Please go through with following link if it can help you -
Serializing classes with hashmaps
13 years ago
your dialect should be as follows -

I want to do the join between both tables as well, e.g., get the country of a specified student, all at the class level. I don't want to do this with a JOIN HQL statements, and i think the best way is using Criteria, am i right?



It can be done by two ways -
1. by implementing a one-to-one condition for student and country in .hbm files
2. by using query OR criteria and attach the where condition.

If you have foreign key relationship established between your tables I would recommend first approach.
Sachin Sunney !

There is no difference As much I understand your code. In both the cases your class B has to implement both the methods
13 years ago
Ok ! I think -
you set level as DEBUG in your code and trying to print log of INFO level

logger.setLevel(Level.DEBUG);
//logger.addAppender(appender);
logger.info("Starting " + logger.getName());

13 years ago

I think if above code may help you !
13 years ago
There are two suggestion if above code does not work -
1. try to print the output of getContext().getRealPath(...)
2. try with appender.setFile(String fileName, boolean append, boolean bufferedIO, int bufferSize)

Thanks
Shalindra Singh
13 years ago
you may write like below -
RollingFileAppender appender =
new RollingFileAppender(new PatternLayout("%-4r [%t] %-5p %c %x - %m%n")
, getServletContext().getRealPath("/logs/error.log"), true);

your logs directory would be parallel to WEB-INF.

Try out this.

Thanks
Shalindra Singh
13 years ago


now if you say - it will pick the instance variable value from Mammal class (since name variable do not get overridden).
but when you write - it will display the output from the method, object does belong to. here in this case it is from Zebra class. (method is overridden in Zebra class).

Thanks
Shalindra
[ Illegal content removed - Dave]
[ August 30, 2008: Message edited by: David O'Meara ]