java

hibernate Open Session in View

i am using the following approach to sole lazy initialization problem in hibernate.Pleas tell me whether it will work or not . I have to implement my transcation in my persistance layer compulsary due to some reasons. public class CourseDAO { Session session = null; public CourseDAO() { this.session = this.session = Hi...

Java class from jython

Hi, I need to access the java class which is running jython script from that script? Any help? update: Something like this: //JAVA CLASS class Test{ public String text; public Test { PythonInterpreter pi = new PythonInterpreter(null); pi.execfile("test.py"); } } So int test.py I need to do some...

On Windows - where is a mqji.properties for me to use?

My application is a stand alone Java app, that customers download, install and run. It uses MQ to communicate with a host, which has been working for years. Neither myself nor customers have anything MQ installed on their Windows machines; we include and use com.ibm.mq.jar to do the work. Apparently though, MQ needs a mqji.properties fi...

Possible Combination of Knapsack problem and ???

Alright quick overview I have looked into the knapsack problem http://en.wikipedia.org/wiki/Knapsack_problem and i know it is what i need for my project, but the complicated part of my project would be that i need multiple sacks inside a main sack. The large knapsack that holds all the "bags" can only carry x amount of "bags" (lets s...

Threads in Spring

I have a Web application using spring and hibernate and struts (it runs on Tomcat) The call sequence is something like this... Struts action calls spring service bean which in turn calls Spring DAO bean. The DAO implementation is a Hibernate implementation. The question is Would all my spring beans be running in the same thread ? Can ...

Importing a certificate into Jetty

The overall goal here is to have jetty be configured with a client certificate to be able to call a secure SOAP web service. Does anyone know how to configure Jetty to accept a client certificate (*.cer) ? Update: I did not find an easy way to implement a solution to my problem/question, but the sole answer here technically is correct!...

Should I be using SwingWorker, threading or a recursive update for this animation?

Hi all. As I have said in my previous questions, I'm still new to java. I'm developing a tile based game in java. The movement is on a grid. I'm at the stage where I'm implementing character movement. My plan was, to use the code which I pasted in this question (http://stackoverflow.com/questions/772713/call-repaint-from-another-class-in...

Java3D simulation assignment

I have been assigned the task of simulating the start of the universe using java3D (particles etc) and must consist of 5 different sections... each of a minimal length of 15 seconds. Stages like the particle soup stage - basically 5 distinguishable visualizations. It doesn't have to be complicated, merely spheres moving around with set p...

How do I make Netbeans believe I have JMS?

I inherited a project that makes extensive use of JMS. It compiles, runs and passes all of its unit tests using Java 6 SE. I created a netbeans (v 6.5) free form project to go along with it. I added all the libraries and everything correctly (checked this several times). Now, here is the problem: it produces tons of Netbeans error messag...

Working with large text snippets in Java source

Are there any good ways to work with blocks of text (Strings) within Java source code? Many other languages have heredoc syntax available to them, but Java does not. This makes it pretty inconvenient to work with things like tag libraries which output a lot of static markup, and unit tests where you need to assert comparisons against blo...

handling DATETIME values 0000-00-00 00:00:00 in JDBC

I get an exception (see below) if I try to do resultset.getString("add_date"); for a JDBC connection to a MySQL database containing a DATETIME value of 0000-00-00 00:00:00 (the quasi-null value for DATETIME), even though I'm just trying to get the value as string, not as an object. I got around this by doing SELECT CAST(add_date A...

JNI vs Runtime.exec()

I have two options - I can either use JNI or use Runtime.exec to execute a C++ library. The C++ program is CPU intensive and long running i.e. some calls may take up to a couple of hours to return. What are the pros and cons of each? Which approach should I go for? ...

Repopulating database driven textbox on form

Hi, I have a database driven textbox that needs to be repopulated when the user hits the back button (a back button that I have created on the form) Currently, I am able to repopulate non database driven fields on the form using http sessions just fine. I cannot seem to apply to same logic to database driven fields. The code on my js...

Creating a Hard Link in java

Currently I use 'ln' command via Runtime.exec(). It works fine. The only problem is that in order to do this fork, we need twice the heap space of the application. My app is a 64 bit app with heap size around 10Gigs and thus its runs out of swap space. I couldn't find any configuration that could fix this. I also want not to use JNI for...

Is there a way to make an ANT task run as Administrator in Windows Vista?

As part of an installer, I need to run a batch file from ANT. If I run cmd.exe as Administrator and run the batch file, all is well since it has the appropriate administrative privileges. When the batch file is executed from ant, it fails, the same way it does if I were to run the batch file without administrative privileges. My question...

How do I check if an object given to me is an int [] in Java?

How do I check if an object given to me is an int[] in Java? ...

How can I write DAOs for resources with extensible properties?

I'm trying to write an embedded (NOT web, not enterprise) content management system in Java, with a focus on organization and ease of use and scalability to 100,000 or so items. The user & system should be able to create and define metadata items which can be associated with unique resources, to allow for searching. For example, they c...

JasperReports PDF. & character causing trouble.

I am trying to create a pdf document with JasperReports. Everything works fine, except than when an & character appears, some tags are not interpreted, and appear in the final document. Do i have to escape de "&" character? I've already tried writing & instead, as well as wrapping a around it. In the first case, & appeared in my pdf, ...

Passing a reference to a (large) data area across a socket

I have been reading the descriptions of referencing in Java, and, while I feel I understand them, I am not sure if Java allows me to do the following: we have two threads in the same JVM communicating via sockets, and we would like to pass what is essentially the address of a large chunk of data across the socket, without copying the dat...

How to copy an AcroForm using iText?

I have a pdf with an acroform. I'm using iText to open this pdf and fill the form fields with some data. Sometimes I need to generate more pages than the original pdf. To do that I create one page and replace with an existing page using this code: OutputStream output = new FileOutputStream("C:\\newFile.pdf"); PdfStamper stamper ...