Martin Podrouzek

Greenhorn
+ Follow
since Sep 09, 2004
Merit badge: grant badges
For More
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 Martin Podrouzek

Fine day to you,

recently I attended a conference about Java in Antwerps. There was a notable speech of Brian Goetz about "Performance Myths in Java".

Here I link some articles of the Brian:
http://www-128.ibm.com/developerworks/views/java/libraryview.jsp?search_by=practice:

Just search for word "performance". I also recommend testing the code of Brian's. Have fun

Martin
17 years ago
I definitely agree Paul, unfortunatelly this is a production DB :roll: .I would never do anything like this. When I saw it for the first time, I was getting sick. I just have to deal with it... somehow.

Martin
Greetings Shrimon

Please note that I'm quite new to Hibernate. Although I am not using criteria queries I experienced simillar problem. I have a legacy table with multiple rows with same primary id. When I run SELECT on the table i get 4 rows with SAME primary id. It seems that hibernate treats them as same row and return 4 rows with same content (?maybe using cache?). In your case I'd check mapping file and if ATTR_ID in your rows have same ID you may have same problem as I.

This is a mere guess but aren't you trying to do one-to-many join?

You can solve the problem by using Java sql (that works fine with this).

I discovered this problem 2 days ago, so I'm at the beginning of investigation.

Hope it helps

Martin
Hi,

recently I'm making an application with legacy MySQL database. I'm using Hibernate along with JBoss. Everything works fine, but one table in the DB is "strange"


As you can guess bu running SELECT you'll get something like
5 John name
5 B surname
5 Mr. title
5 32 age

now,
when running session.createQuery(...).list(); I get 4 times 'name' collumn.
Running session.createQuery(...).scroll() I get empty ScrollableResult (not much surprise here)
I'm not even capable of mappging User using either @hibernate.bag, or @hibernate.set (I can't use List or map since I can't add index collumn to the DB), as this gives me errror.

XDoclet code:


Error it gives:
12:15:02,468 ERROR [Configuration]
Could not configure datastore from input stream
java.lang.NullPointerException
at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)

I have doubts, whether it is even possible solve this with Hibernate. I could get the data with JDBC, but I'd like to have my code as clean as possible.

Thank you for any advise.

Martin
Hi Stijn

I think it greatly depends on the server you are using. Personally I favor JBoss 4.0.1 due to its automatic (hibernate) session handling. There is a new type of archive called HAR that simplifies mapping and configuration of hibernate. You can find further info on www.jboss.org.

I'm skating on thin ice here, but JBoss is using transactions to handle hibernate sessions if configured so, and you connect to JBoss managed session factory through JNDI. If the transaction ends so ends session.

While I was experimenting with ordinary (manual session creation) approach I also find out that if you don't close the session JBoss recogize that and close the session for you. Of course everyone's closing sessions, right?

Unfortunatelly, infos, about HARs and transactions are on a short supply ( this new JBoss managed session approach), so if you know about anything, please let me know.

Martin
Greetings Patricia

it's been a long time since I experienced this error, so my memories are a little dim. As far as I can remember this error occured when I was running JBoss prior to 4.0.1 and struts 1.1. I found TagExtraInfo class in many jar files depending on the version of the JBoss. I'd say there is a colision of jar libraries and I'd focus on jar files named *servlet*.jar.

I suggest you do the following:
Make a clean install of Jboss and deploy struts-blank.war file from the Struts zip file. Do not copy any jar files to the default/lib directory. If you'll be able to run the app, then try to deploy the application you're trying to migrate.

By the way which version of struts and JBoss are you using?

Hope it helps a little

Martin
18 years ago
Hi,
Eclipse displays:

No enclosing instance of type OuterClass is available due to some intermediate constructor invocation

I'm using Eclipse 3.0 with JDK 1.4.2_06.

By the way, do you experience any differences when you use InnerClass instead of OuterClass ?
InnerClass inClass = new OuterClass().new InnerClass() { ... };
[ March 29, 2005: Message edited by: Martin Podrouzek ]
Greetings,

I was experimenting with code while preparing for the exam and I came across a problem I couldn't solve. I want to create an anonymous inner class that extends its enclosing class (its parent). I was thinking of something like this (please note that code will compile with javac, but fails under Eclipse):


I would also like to polymorph the anonymous class to its parent. I'm not sure if the code is ok, since I wasn't able to run it. I believe that the code would yield "Anonymous Inner class eating", but I'm not sure. Do you know what's going on "under the hood"?

Any hints, advices are greatly appreciated.

Thanks

Martin
Fine day to you Jasmine

frankly, some time ago I came across very same problem. As far as I am concerned using only provided validators

won't work. I'm going to state here how I solved the problem, as well as other possible (hypothetical) solutions.

I haven't used validator in form, you probably seek. The task requires branching and 2 different tests.
If I got it right something like this:



I used server-side validation, and validated input in the Action class.

Struts validator gives you opportunity to create your own validation classes

(http://struts.apache.org/userGuide/dev_validator.html) .
I haven't tried but after writing your own class you could also add CDATA part to validator-rules.xml file, that

would create client-side validation Javascript. Than, it's up to you how you write the validation classes. I'm going

to write my own classes with such feature. As soon as I'll have something, I'm going to post it here.

Now for the other possible solutions.

First of all it is VERY important to note one phenomena:
Using strings for conditional statements are pain (ie: contact.country == 'en'). PLEASE NOTE that this is code used

to generate JAVASCRIPT!
In case of validwhen the generated code will look like this (obviously):



neither single nor double quotes will work.
Unfortunatelly, escaping characters or using character entities won't help either, since validator will add another

backslash resulting in



Does anybody know how to enforce single backslashes?


Following part is for those willing to investigate the problem.

My other ideas:

Idea 1 (Failed):
Use 2 validator tags for one field moving less probable option prior to more probable. If the first option would

fail, second validation would override first.

example 1:


result 1:
Struts will generate 2 validator functions. One function will succeed while other will fail, rendering an error (and

vice versa).

Idea 2 (failed):
Omit mask attribute and implement reg exp. validation in validWhen directly.

example 2:


result 2:
Failure, due to problem with above-described strings.(Using single quotes won't even generate the code) Validator will generate this code:


uff...

This way seems to be a dead end.

Martin
[ October 09, 2004: Message edited by: Martin Podrouzek ]
19 years ago
Fine day to you Tanveer

I had simmilar problem, and this is what I came up to:

1) I forgot to copy antlr.jar to my lib folder. Make sure you have this file
in your lib folder

2) I moved validwhen to the front of depends statement like this:
depends="validwhen,required,mask">
as well as <var>...</var> tags
dunno if it has any effect.
this is how it might look:


3) I have tried your code and got several errors "not-well formed". It might be obvious but < (lesser than) is ILLEGAL in XML try using < (ampersand lt semicollumn ) instead.
ie:


After I replaced this character it worked fine

The above code is also an example of code for anyone trying to combine mask and validwhen.

Hope it will be of any help

Martin

[ September 09, 2004: Message edited by: Martin Podrouzek ]
[ September 09, 2004: Message edited by: Martin Podrouzek ]
19 years ago