This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Manish Jaju

Greenhorn
+ Follow
since Jul 21, 2004
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 Manish Jaju

Hello,

I am using JPA/EJB3.0 to persist data.
I have a parent entity p1, which has list of Child entity c1,c2.. Child has foreign keys one of them refering to p1's primary key and other is refering to other entity s's primary key.
When I save p1, it gives me error "Cannot add or update a child row: a foreign key constraint fails"

The problem is that p1 is not saved yet i.e. its a new object and its PK is not available till it is saved.
How can I assign foreing key value in child entity which is refered from parent p, which is not saved.
I did try this, but it didn't work

Parent1 p = new Parent1();
p.setValue1("val1");
.
.
.
Parent2 s= entityManager.find(Parent2.class,1);
Set<Child> cs= new Hashset<Child>();
Child c1= new Child();
c1.setValue1("abc");
c1.setParent1(p);
c1.setParent1Id(0); //which is Parent1's PK
c1.setParent2(s);
c1.setParent2Id(s.getId) // which is Parent2's PK
cs.add(c1);
p.add(cs);

entityManager.persist(p);


I did try to set Parent1's PK value to -1 in child object. But It didn't work.
Am I missing something which is causing this problem..

Any help would appreciated.

Thank,
Mani

Is there any limit specified for a JSP page to compile in servlet.. At one point of time, I faced this kind of problem where JSP engine was unable to compile JSP as the page exceeded the limit of JSP page to compile. Is there any solution for this. Thanks in advance.
Mani
15 years ago
JSP
Dear All,
I am facing a problem, while copying a file from one location(which is outside deployment environment) to another location(inside deployment environment) at run time.
I can do same by reading each line of file, and writing it to destination file one by one.
Is there any direct method, where I can copy whole file from one location(which is outside deployment environment) to another location(inside deployment environment).
** I am using JBOSS as an application server. **
Any suggestion will be highly appreciated.
Thanks in advance.
Manish
16 years ago
During response.sendRedirect, How client comes to know that it has to again make a new request. How that Information is sent to client(for making a new request). Can anybody clarify this.
16 years ago
What all steps take place during deployment
Thax for the response.
But still I am not clear with the difference/s....
As per the above explaination, there should not be any difference between static variable and transient variable while serializing process.... Then why to use transient, we can evidently opt for static only???
Please clarify.
16 years ago
I would like to the the difference between static and transient variable used in Java Programming. and how these variables make difference in case of serialization.
16 years ago
I have some doubt regarding post and get methods, used to process a request... What I understood, that if parameters append with URL then get is used and to send it hidden, post is used... Is there any other specific reason to use get or post except I mentioned above. Please clarify
17 years ago
What will happen in the case below

class A
{
int a(int b)
{
//somecode
}
}

class B extends A
{
byte a(int b)
{
//somecode
}
}


public class C
{
B b=new B();
b.a(10);
}


What will happen in case a(10) be called, Which method will it call??
17 years ago
What is reflection and introspection in java. Will someone elaborate it with example and how it is used in programs. I will be very thankful.
17 years ago
Why doesn't Java allow multiple inheritance using extend keyword, i mean, why java allow only one class to extend.. Please clarify.
17 years ago
When a servlet is called from other servlet using include or forward method of RequestDispatcher, at that time, are doGet or doPost methods (of called servlet) called from calling servlet??? Will someone elaborate this point, I mean explain flow of programm for same above. I will be hightly obliged.
17 years ago
What is difference between iterator, enumeration and listIterator.
17 years ago
But servlet is also java file, won't it be included in Jar file. and what about EJB files, which are also java Files. Please clarify
17 years ago
What are differences between Jar, War and Ear File.
17 years ago