Prashant R Kataria

Greenhorn
+ Follow
since Jul 23, 2007
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 Prashant R Kataria

I doubt your mapping will not work.






Key column will map to a foreign key in funcionalarea table, I can see that both pk and fk of functional area share the same name with pk having id generator as native in functionalarea. This is wrong.

You should use different name for foreign key and then follow Mark.
There are two types of transaction management

Programatic: What you just did.

Declarative: Which will use aop of spring and do comit and rollback for you as per the configuration provided.

Go to the link below, search for the declarative transaction there.
http://static.springsource.org/spring/docs/2.0.x/reference/transaction.html
8 years ago
Oh I missed it, apologize for creating confusion.

But question remained there as it is, why would they not allow long constant conversion to byte if it is in the range of byte.
8 years ago
Yes, I agree with you, it should not make any difference. I searched through java language specification and ideally long constant to byte should have worked. But, unfortunately, it did not.

I thought, only difference is long being 64 bit which will require two registers and int will require one. So I was thinking that on 64bit environment the size of the register would be 64bit and hence all types, byte to long, will reside in single register. This was just a wild thought/assumption and that's why I recommended one experiment to clear this point if it has anything to do with this theory.
8 years ago
Yes what peter said is correct, you will not get more than 2GB of space in 32bit unix or windows system. However, on 32bit solaris machine you will get 3GB of memory.

But I would advise that you make sure that you really need memory more than 2GB. If you really do then you should go for 64bit environment.
8 years ago
Kevan, the code you have written doesn't demonstrate use of volatile.

I am just pasting the explanation over volatile written in Java language specification.

The Java programming language allows threads to access shared variables. As a rule, to ensure that shared variables are consistently and reliably updated, a thread should ensure that it has exclusive use of such variables by obtaining a lock that, conventionally, enforces mutual exclusion for those shared variables.
The Java programming language provides a second mechanism, volatile fields, that is more convenient than locking for some purposes.

A field may be declared volatile, in which case the Java memory model ensures that all threads see a consistent value for the variable. If, in the following example, one thread repeatedly calls the method one (but no more than Integer.MAX_VALUE times in all), and another thread repeatedly calls the method two:


then method two could occasionally print a value for j that is greater than the value of i, because the example includes no synchronization and the shared values of i and j might be updated out of order. One way to prevent this out-or-order behavior would be to declare methods one and two to be synchronized:

This prevents method one and method two from being executed concurrently, and furthermore guarantees that the shared values of i and j are both updated before method one returns. Therefore method two never observes a value for j greater than that for i; indeed, it always observes the same value for i and j.
Another approach would be to declare i and j to be volatile:

This allows method one and method two to be executed concurrently, but guarantees that accesses to the shared values for i and j occur exactly as many times, and in exactly the same order, as they appear to occur during execution of the program text by each thread. Therefore, the shared value for j is never greater than that for i, because each update to i must be reflected in the shared value for i before the update to j occurs. It is possible, however, that any given invocation of method two might observe a value for j that is much greater than the value observed for i, because method one might be executed many times between the moment when method two fetches the value of i and the moment when method
two fetches the value of j.


A compile-time error occurs if a final variable is also declared volatile.
As far as relationship is concerned, Uni-Directional or Bi-direction is up to you and your requirements.

for one-to-one association between parent and child:

In parent class for child property:

<many-to-one name="childPropertyName"
class="ChildClassname"
column="CHILD_COLUMN_NAME_IN_DATABASE"
cascade="all"
unique="true"
/>

By doing this your parent class will have fk which will be primary key of child class.




You will have to do following things:

1) Keep polling on input and error streams continuously, you will have to create separate threads which will do that.
2) get the output stream of process and pass the strings to it by taking them from standard input stream of the application. Use system.in for that.

8 years ago
can you send the snippest of your hbm files.

However, hibernate uses foreign key which maps has-a relationship in object model. So in order to have parent id in child class you will have to have a fk constraint on child table.
I think, this behaviour is because long and double are treated differently in java. They are 64bit and two registers will be required to store long/double constants. Since byte ... int constants are all stored in single registers, compiler should be able to compute & compare their value. However, long will require some special treatment to compute its value.

Moreover, if you know the java byte codes, there is no longtobyte conversion instruction, there is only longtoint conversion instruction.

Anyways, Even I am not aware of any exact reason or not satisfied with above explanation.

Are you using 32bit JVM? Could you execute same test in 64bit enviornment to see if it behaves differently.
8 years ago
Hi,

I found another way of handling class loading in this case.

I can create new folders and put my property file in every folder. Now depending on which property file I want to load I will put that folder in classpath.

I think this will reduce the library unloading problem for me.

I have started working over it and will give you update of the result.
10 years ago
Thanks for your inputs, I am working over it, I will let you know if there is any update over this issue.
10 years ago
How can I unload particular class?
10 years ago
The library I am using is of my vendor and they haven't provided source code with it nor we have license to change it.

I am calling one method of a class which has some logic that reads the property file from classpath.

I am not aware of what kind of code they have written in it, but I am bound to the contract that I have to have a Property file with particular name in my classpath.

That method is returning me one object. Now if I call that method second time after changing values in property file than I want the new object to be created with new values but that is not happening,it is taking values loaded at first time.
10 years ago
In such scenarios one should use resource pool mechanism.
10 years ago