Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!

Natalie Ap

Ranch Hand
+ Follow
since Jan 09, 2009
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 Natalie Ap

Hi Rahul,

Thanks for the quick response.

Tell you what..This code worked fine till Thurs. On Friday, I was tinkering around a bit trying to learn how to enable the Hibernate caching and connection pooling. After that, this weird error started appearing for ALL queries in my code.. So I changed my hibernate config file to what it was before. The DB was not touched, not was the code. But this error ha been coming and I cannot figure out what to do about it.


Any clues anyone? Please help!

Thanks,
Natalie




Rahul Babbar wrote:Hi,

Most of the things seem right...
Is the User table is already present in your database or are you trying to create it using Hibernate.

I have a suggestion...change the table name in your hbm and the database to a name other than 'USER'..
to
<class name="User" table="USER_LOGIN">
or something like that..and make sure the table name in your DB is USER_LOGIN(or something else, but not USER)

I vaguely remember that sometime back, i was getting some weird error by using Hibernate with MySQL while trying to name the table name as USER....and hibernate complained...and changing the table name did the trick...
It sounds silly, but is true..(as far as i remember)

Hi all,

I am stuck with this since a very long time. I am getting this error for an HQL or a native sql query in hibernate. I

request you to help me. I am unable to find the post where this has been discussed before. Kindly help!


Error


Code


xml files



Hi all,

We are building a web application that would use the following technologies:
1) Spring
2) Hibernate
3) Tomcat
4) MySQL database

The site would have 120K to 140 K users. We need to build a scalable server that can support so many users and one that has a good
response time. Can anyone please pool in suggestions, tips, etc on how to go about this.
Which design patterns we could use, what sort f optimizations can be applied while building the site?
Thanks,
9 years ago
Hi Rob,

I tried doing that. But my output is as follows:

FirstThread
FirstThread
FirstThread
FirstThread
FirstThread
FirstThread
FirstThread
SecondThread
SecondThread
SecondThread
SecondThread
SecondThread
SecondThread

Why does the Second thread enter the method at all when it is a synchronized method and when there is an infinite loop within it!

NP


Rob Prime wrote:Both MyThread instances synchronize on itself - their synchronization is separated.

The following will work as you expect:
This is because the same MyThread instance is used (as a Runnable) in two different threads.

9 years ago
Hi all,

Please check the following code:



Despite of the method callMe being synchronized, when I run the program, I get the following output:



I would expect one of the threads to enter the callMe() method and stall it, so that the second thread cannot enter it at all! Can someone please help me understand the output? Also, if there is something wrong here, how do I correct it so as to allow only one thread to enter the method?

Thanks,
NP
9 years ago
Hi all,

I have heard of scalability issues with a few applications where Hibernate is used. Please let me know in case anyone has faced any such issues. Also, please let me know of the possible cause for this.

Thanks
On my UI, I am displaying a list of objects:

  • Employee id: 1
    Employee Name: xyz
    Age : 28
    Phone: 235325



  • Employee id: 2
    Employee Name: abc
    Age : 30



  • Employee id: 3
    Employee Name: pqr
    Age : 25
    Phone: 363433


  • The above fields are editable (except employee id) and have been loaded dynamically on basis of a search mechnism (to load employees with specific properties.) Since they have been loaded dynamically, the names of all fields are the same on the UI. They look like this.



    Similarly for phone. But phone may or may not exist on the UI depending on whether an employee has a phone or not.


    The entire form has one submit button, mapped to an updateAction to update the new details put in by the user.

    My Action form contains a String[] array txtname, String[] array txtage and and String[] array txtphone. When the details on the UI are captured in the above properties, in order to decipher which employee name, age or phone corresponds to which employee id, I have appended the employee id to the values of the textboxes.

    BUT I think there must be a way in which i could capture these details in a better manner (in objects). So, in the my ActionForm i could have a list of Employee objects, each of which would contain the details submitted from the UI. But i am not able to figure out how to go about this.

    First of all, can my ActionForm contain an Employee List which could be populated automatically with details from the UI??

    I am simply looking for a better way to do this. Please advise.

    Thanks.
    9 years ago
    Hi all,

    I am trying to run the following piece of code, but I am getting a javascript error "Object does not support property error!" and I am unable to understand what the problem might be.

    There is a form called "updateForm" which I am trying to submit when i get the error. When I comment lines (1), (2), (3), the error does not get thrown. Please help me!!

    Please let me know if you need any other information besides this.

    Thanks,



    Hi,

    I am trying to install Easy Struts plugin for Eclipse 3.3 or Europa.
    I have copied the folder of the plugin into the plugin folder of Eclipse, but when i start eclipse, it does not appear to have been installed. Please help!!!

    Let me know in case you know of any other plugin as well.

    Thanks
    9 years ago

    Amit Ghorpade wrote:By making a variable transient, you indicate that the variable does not add to the object's state and hence should not be saved/serialized.
    Now when restoring the same object, transient variable value is not available and it gets the same treatment as class variables get during initialization and gets assigned to default value.


    Hope this helps



    Thanks! I understood the concept of transient variables now!

    Ankit Garg wrote:From where did the class Poddle come. You didn't show poddle class in your code...



    Hi Ankit,

    Sorry, Please consider the following code as an addition to thecode above:

    Hi all,

    From Kathy and Sierra, from the Chapter Objects and Collections: The hashCode() Contract: i gather the following:

    Suppose an object having 2 variables x and y is serialized. x is transient and y is not. While serializing the object, the value of x = 10, y = 9. After we deserialize this object, the value of the transient variable reset to the default value. So will x be = 0 after desrialization? Why does this happen?

    Thanks
    Hi all,

    Another Generics question from me. Thanks to Vierda Mila for answering my last few queries!



    In the above case, <? extends Dog> indicates Cage can contain any subclass object of Dog. The RHS indicates that the object created of Cage needs to contain a type of class Poodle. Then why is it that any of the getElement() invocations do not show a compilation error.
    According to my understanding, it is because, <? extends Poodle> allows addition of only null objects to the cage. Hence any retrieval using a getElement() expects a null object to be returned, which can be type-casted into any other class (Object/Dog/Poodle/Labrador). Please correct me if i am wrong.

    Why i find this tough to understand is because i do not see a practical usage of the above syntax. Please let me know if there is any.



    Vierda Mila wrote:Hi N path,

    one rule you have to remember here that polymorphism is not apply for generic type.
    if you provide as per below it will result compile error :

    Cage<Animal> cg1 = new Cage<Dog>();

    but these example is ok :

    Cage <Animal> cg1 = new Cage <Animal>();
    Cage<? extends Animal cg1 = new Cage <Dog>();

    please check this one for further information

    regards,
    -Vierda-



    Thanks for your reply Vierda.

    But what exactly does the syntax mean then? If it is to be explained in simple english..
    As in,
    Cage<Animal> cg = new Cage<Animal>();

    Cage<? extends Dog> cg1 = new Cage<Dog>();

    According to this syntax, cg can contain an object of Animal class. Then what does the type in RHS signify?

    In the first case, the type in LHS and RHS is the same. Why is it not the same in the second case? Why can't we write the following
    Cage<? extends Dog> cg1 = new Cage<? extends Dog>();

    This is a little tough to explain! But i hope you understand! All i mean to ask it, what do the types on each side indicate in plain English?


    Hi all,


    Given the following:

    Animal class

    Dog class extends Animal class





    Please explain to me why the following is not allowed: (gives compilation error)

    Cage<Animal> cg1 = new Cage<Dog>();

    I always thought it means that LHS indicates that Cage may contain objects of Animal class. And by doing the instantiation in RHS, we are specifiying that the objects added would be of type Dog. Since Dog is a subclass of Animal, it should not matter even if Dog is added to the Cage.


    Thanks