Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Sharon Adar

+ Follow
since Apr 29, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sharon Adar

I'm running a jboss-4.2.0 server, and a java client uses one of my stateless.
How can I, in the stateless, get the current using client IP?
Thank you!
12 years ago
Fast question:
Inside pre remove callback i've executed a EJBQL query, but no flush occurred, Why?

In our application we have decided to add �erasion validation� � By using pre-delete, we catch all entities erasion requests, and check by querying the DB whether any applicative* references exist to the deleted entity
(* Applicative reference is a reference which can be seen in the java object, and won�t be automatically deleted once the requested entity is removed)

The problem is, that before we run the erasion validation � we make some applicative changes, and then querying the DB by using SQL statements. In this level, the application references are not synchronized with the DB references, and not all applicative changes are reflected in the DB.

One kind of solution will be Flush the DB before executing the validation queries. This solution is bad since we catch the delete at �pre delete� stage, and flushing during cascade (which may happen if we delete a hierarchy of objects) is wrong.

Any better ideas of how can I ensure the DB is synchronized with my java application?

Thanks in advance,
Although it looks like a real simple question, I want to ensure I�ve chosen the best solution.

I�ve two Classes A and B and which has reference to the same(!) instance of class C.
The cascade type of C in both A and B, includes cascade.persist.
In my test, I�ve created instance of A and an instance of B, as commented before-
Both instances reference the same instance of C.
I�ve saved A and B�s instances, and of course although A and B were referencing the same C,
The C instance got two different orm-id (one in A�s hierarchy, and on in B�s).

My solution was to persist C first and then set A�s C and B�s C to be my instance.
Any better idea?

I�ve tried to use interceptors, in order to keep some information about the user.
Yet � when using it, somehow all my exception are being caught and I lose my stack �trace!
In my JBoss server � I see no error!

I�m sure I�m doing something wrong, and I�m sure it�s something silly.
Can you please help me?

Attached is my pseudo-interceptor.

I've tried Remko suggestion, and wrote this simple main:

Surprisingly, executing "SET FOREIGN_KEY_CHECKS=1" succeeded, in spite of the illegal my_second_class_id 'pizza'! Those changes were written to the DB, and showed no errors or constraint failures!
I didn't expect this.
I hoped once the constraints are turned on, all the rows will be checked, and a sqlException with constraint failure will be thrown.
How can I see those errors once the constraints are back?

Thanks again.

In addition to all the answer above, remember you can always create your own array in creation time by using the following syntax :
13 years ago
Thanks for your real fast answer!
unfortunately, I can't order the updates before the execution...

Do you know any other way to do this disabling through Jdbc?
Thanks for the real fast answer!
unfortunately, I can't order the updates before the execution...

Do you know any other way to do this disabling through Jdbc?
(java / mySql)

I�m trying to run some batch commands one after the other -
Yet since part of them may fail due to constraints failures �
I want to turn off the DB constraints, and turn it back on just
after the last batch is executed (in the same connection!!!).
Once the constraints are back � I want to see all the constraints failure.
(apparently � there�ll be none)

How can I turn the DB constraints off at the beginning of the batch execution,
And later turn it on and see the result and errors?


I�m facing a merge problem between two updated databases;
I have a configuration scheme that once in a while forks and both versions are updated independently.
Yet when the user asks, I need to merge both schemes into one in which changes from both schemes will be taken.

Is there any automatic tool which I can configure its rules and will do the merge automatically?
If not, what is the best way to do so?

hibernate 3.2.1 w\ MySql

I�m having problem with the way hibernate manages one-to-one relationship.
Before starting, some history regarding the problem:\

As far as I�m concern, when creating a new one to one relationship between �myTable� and �My otherTable�, the creation SQL will define the constraints �on delete� default to �restrict�

SQL creation command example:

That causes be a lot of troubles when trying to remove myOtherTable instance.

A lot of problems example:

A good solution here will be to change the constraint �on delete� default to �set null�, yet, I didn�t find a way to make hibernate to do this for me. The only options as I can see that are
a) To manage the delete by my own .
b) To create my DB alone.

Any better solutions?

Surprisingly I can!

You can pass multiple parameters as a list.

For example:

The named query :

Using the named query (and setting the parameter!):

It works!

I�m trying to write a named query which uses an �in� query �
something like : select * from Drink d where name in (�coke�,�7up�,�)
I can�t use parameters, since I don�t know how many of them are.
Neither can I pass a string like �coke,7up,�� .

Any idea?