Miltos Tereres

Ranch Hand
+ Follow
since Sep 04, 2009
Merit badge: grant badges
For More
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 Miltos Tereres

Hello i have a unique collumn... @Column(unique=true)...

The problem is that i want to inform the user if he attemps to persist something that violates the uniqueness.
Catching the error is a bit difficult because it is vendor specific and i should do a

em.flush() otherwise the transaction will commit after the end of the method

I see that this solution isnt good and although that it catches the exception multiple exceptions are thrown before and after this catch and polute the server log.Isnt this a perfonace problem?
The alternative would be a query but what if this scenario happens?
eg user1 want to persist an exam with codename MPLAH ,user2 want to persist an exam with the same codename MPLAH...
checkifcodenamexists (user1) and then checkifcodenameexists(user2)... both would return false...
then persist(user1) would be ok persist(user2) would cause an error!
I know that this would be an nearly impossible case (2 users at the very same time try to insert something with the same value) but generally i would like to know what i can do about...

Someone told me that locking would be a solution..However if i lock the table the exception should be thrown from createExam and no before calling this method at validation time...
any ideas?
thank toy

Hello... I am using rhino and Scripting for the Java Platform in order to allow the user extend my application.

However the user can write some cases eg (ASTO.value>440) || (ASTO.bellowNormal) etc... The problem is that before running the script from my JAVA application using ScriptEngine i want to get the names of all the variables! Because i should know which variables are required for the script to run... I know that a regular expression would do the job but i amnt sure... Please i somebody could help me figure out the java regexp to get the variables or another way i would really appriciate it.

However i tried cx.getDebuggableView(result).getParamAndVarCount() from rhino classess and it returned only declared variables:(
14 years ago
Or as a top-level JavaScript object that the loaded script can reference.

What do you mean?
Hidden fields is a solution... but i want them to be at the top of the page...

<script type=text/javascript>
var mydata=<here goes the function that outputs a javascript escaped json object>

<script type=text/javascript src="external_crap.js"></script>

Is this a good practise or not ?

Someone said to parse a custon external js file...But is this ok ?I think that it makes thinks more complex....
thank you
If the page is a jsp and i include a javascript i cant use jsp tags etc in my js.
Only in the page.
So cant put initial parameters.
Hello guys....
I am developing an application where the user inputs some data to a table.
The data is appended using javascript+jquery... Code places some hidden fields and populates a table....
And i have this code at an external javascript file...

The problem is that when i want the user to retrieve what he has put ,populating the table using server side script seems a waste of time and writing code again which i should change if i change something in the javascript...

So i thought to get a JSON response from my server and then call the javascript method to populate the table....
The problem is that i should place the javascript code in my page and not at an external file ,because at an external it wont be parsed...

Also i would like to get advices how to solve this problem....
thank youu
I have two entities(actually more but it doenst matter)

Exam and Exam_Normals

Its a oneToMany relationship... The problem is that i need a primary key for Exams_Normals PK (Exam_ID Item)
Item should be 1 2 3 4 5 etc....

I cound use an IDENTITY and a ManyToOne relationship at Exam_Normals but that should be like PK(Exam_Normals_ID) and a reference to Exam and an extra collumn
Item to keep an order.. SO 3 collumns

I tried with @IdClass and got errors
Tried @EmbeddedID everything nothing works:(

Any idea??

I have a jsp which has some checkbox options which are generated dynamically...
The problem is that i want to have all checkboxes unchecked or
to have the ability to have some checkboxes selected...

isnt a solution because i think its not good to serialize the object which holds the data which determine the checked checkboxes...However

<s:inculde does the same..

so the only solution to this is to do
What do you think?

The problem is that this page should be included in a larger page... It should be a part...
14 years ago
thank you man...
but this worked at
2.1.6 struts

<s:if test="id == selected_id">

selected_id was a parameter also....
14 years ago
Books didnt mention that...
I dont know whats happenning...anyways!
I see my older project with struts 2 and i see there that i called parameteres
#parameters. prefix and worked fine...Now nothing happens
14 years ago
#parameters.menuKey[0] only works... why??? I didnt pass an array:S
14 years ago
i found why ....

#parameters.menuKey is an array!

I dont know why.....

Indeed i dididnt use an action.... but this wasnt the problem...
Now i do

without namespace="/" doesnt work...
dont know why
14 years ago
I am forced to use struts

<jsp:include page="template/menu_top.jsp">
<jsp:param name="menu_key" value="configure"></jsp:param>

This calls menu_top.jsp

menu_top.jsp has some TEST code...

|<s:property value="#parameters.menu_key"/>|
|<s:property value="#parameters.menu_key == 'configure'"/>|
|<s:property value="#menu_item.key == 'configure'"/>|

the result is....






|<s:property value="#parameters.menu_key == 'configure'"/>|
is never true for some reason.......

The only fix i found is to use #attr instead of #parameters...
am i missing something?
14 years ago
It's a nice book.
Many examples , how to use with EJB and many more..
Its a bit complicated though for beginners but its ok to understand some basic stuff.

Thank you for the reply...
I am trying to understand why it works only from the owner side in one to one relationships...
I will read again your link...

so doing ac.setemploye() only instead of e.setaccount it would work?
i ll try...thanks...
maybe to look at embedded entities??