Mario Schwaiger

Greenhorn
+ Follow
since Jun 14, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mario Schwaiger

Thank you for your help!

Made my program run =)

7 years ago
I'm pretty new to JavaFX and would like to establish a waiting window (modal) for an operation which is going to consume more time.

Strangely, when I use the code like that the window only opens AFTER:



Other Variants like are ending up the same way and just using some text-information like are having the same result: They give the information after the operation was finished.

Doing some research made me switch to a thread instead, coming up with this and the class LongOperation o, which implements Runnable.



Haven't really worked with threads for a while and seems mixing it with FX is not something I understand too much of :/
Help is highly appreciated, thank you
7 years ago

and calling this method.



Seems to be interesting, yet due to the policies of Microsoft the implementation it's not so easy to actually use it.
I'm having a Maven-Project using Tomcat's data-source - so actually working with a SQLServerConnection-Object is tricky.

But I assume that's the only possible way. Many thanks for your research, I assume this problem is solved
After the upgrade to Tomcat 8 I read the documentation more carefully and found out about some interesting logging-options. Sometimes queries to a slow DB-Server fail and the logs state an interesting message:


It's quite interesting to to see a ClientConnectionId. I tried to find some information about it and but most Forum-Entries were just related to Tomcat-Logs. Does any one have some information if and how there are possibilities to obtain this ID in Java?

Thank you

why not make it a proper constant and make it static?


Because it's not necessary - these variables are ~100% used within that class. Also doesn't change anything (http://stackoverflow.com/questions/3805155/are-java-static-calls-more-or-less-expensive-than-non-static-calls)


I prefer the method with the constructor, too.


What if different constructors with optional set of specific variables exist?

If it is assigned just once, I would prefer to make it final and do the assignment in line:


I forgot to mention that, you're right ;)
10 years ago
Good to know...
Personally I prefer the fist one too, mostly because it's independent from the constructor (Given the case there are more constructors).

I thought of it more of a bad style to assign variables directly
10 years ago
Given the case I have an object which is assigned only once.
What is the difference in doing:


and


Is there a difference in performance or usability? (Given also the case there are no static calls expected)

Thank you
10 years ago
Hi!

I am an Austrian freelancing Engineer in Software development (~5 years experience, mostly Java-related and databases). For the past years I used to work for several companies, but mostly in their offices which I'd like to quit and implement from home.
Unfortunately I don't have much experiences how to gain such a job. I've talked to some other programmers who already were in the fortunate position I'd like to be in but mostly I was told I'd need the right connections.
As European citizen the whole continent is open for me but my success till now could be bigger.

Can someone give me an advice?
Thank you
11 years ago
Hi!
Till now I haven't used caching in Hibernate but it seems pretty useful to me.
I found some tutorials HOW to use it but so far nothing WHY to use it and WHEN (NOT) to use it.

Could someone close my gap in education please?

Thank you
Works perfectly!

I checked out StackOverflow here:

http://stackoverflow.com/questions/5303671/configure-hibernate-to-connect-to-database-via-jndi-datasource

Even though, jpkrohling says it is necessary to use a persistence.xml, I'd say, it's not. For those, who have the same struggles as I had here's my new hibernate.cfg.xml. Everything works fine. Many thanks to Ulf for sharing his knowledge.

Ulf Dittmer wrote:In a web app you should generally use pooled connections, and if possible the pool that is built into the servlet container (if there is one).



Ok, I implemented it. Thank you for the information. So now, I should be able to use pooled connections?

Everything works as it should, just those doubts always...

By the way: Is it possible to implement this connection pool for Hibernate as well?





Hi!

I am working on a JSP-Project and sometimes I have to fetch or update the Database with JDBC. (I thought about using Hibernate but it would make more afford to use Hibernate for just some easy updates...).
So I bind my basic connection as a bean to the session:



Still I have some doubts whether I am doing everything in the right way (using Pooled Connections, Sessions...). Everything works fine so far, but I'm still unsure.
Thank you!



In the JSP-Files I use this connection in that way. Is there a possibility to check if the connection is really pooled?


Hi!

I am dealing with a Java-Web-Application which works with Hibernate and JDBC (I use BoneCP for the Connection-Pooling) to a MS-SQL-Server 2008.
I use a class to provide the basic-connection (Basicconnection.Java) and a bean to provide some cached values for every session.

As I deploy it it works fine. Can't complain. But after a while an exception is thrown and I'm unable to figure out, why:

Aug 01, 2013 3:00:44 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at datenbankbohnen.Persistenzen.initialisiere(Persistenzen.java:100)
at org.apache.jsp.Partial.Material.Material_jsp._jspService(Material_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)





The error occurs in line 22:


The class Basicconnection looks like this:


What am I doing wrong? Could it be a connection timeout? As said, during the first ~10 Minutes everything goes as expected. And then just Null pointers and I'm unable to make it work any more...
Thank you in anticipation!!
Actually... For me that didn't work.

But luckily I had an old version of my pom.xml which was working. The error drove almost crazy. I stared to add more and more unnecessary libraries and always the same error:

java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery



The current version of hibernate-core is: 4.1.7.Final
But if you choose this version together with some other up-to-date jars you'll get a ClassNotFoundException. Use an older one and everything will be fine.
If you got to this page with the same troubles as I had, feel free to copy my pom...