java

What is the BEST way to pull data out of the hibernate layer and into another tier?

As my previous posts can attest, I'm retrofitting in-memory, network-cached performance to what was once an entirely hibernated scenario. In doing this, I'm hitting problems where I deal with proxied objects and need to reattach to sessions, but in doing this I also want to maintain transactability. What are the best practices from movin...

How to implement a SQL like 'LIKE' operator in java?

I need a comparator in java which has the same semantics as the sql 'like' operator. For example: myComparator.like("digital","%ital%"); myComparator.like("digital","%gi?a%"); myComparator.like("digital","digi%"); should evaluate to true, and myComparator.like("digital","%cam%"); myComparator.like("digital","tal%"); should evaluate...

displaytag problem

Hello everybody. I am trying to use displaytag for the first time and having a problem with the displaytag, that i seems not be able to solve. I googled for solution, but couldn't find nothing over internet. Everything else is working it is the only thing thats not working. Pretty much i am trying just do simple display of table. the ...

How can I create an image dynamically on AppEngine

I have an application hosted in Java on AppEngine and I would like to add a feature where users can get a graphical summary of their data. BufferedImage is listed as not supported on AppEngine. The display process will be simple--a series of small squares in one of two colors. Regards, Kent ...

Populate envers revision tables with existing data from Hibernate Entities

I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables with the existing ...

How to extend IconNodeWidget class in java?

I should make a GUI that uses Visual Library. I have a scene where users can put nodes and edit some propierties. Then I want to save each node propierties. For that i'm trying to extend IconNodeWidget class to add some members to the nodes (let's call them X and Y). When user select a node and choose edit propierties i should show that ...

Using JXPath to Query a List

I have a simple class (for testing purposes) that I am trying to Query against using JXPath. I create a list of various animal objects, and I want to get an Iterator for: All Animals where type='CAT' All Animals where numLegs = 4 Here is the simple class: public class Animal { private UUID uuid; private int numLegs; ...

java servlets: better way to do multiple inserts and locking tables?

I'm currently running the follow code segment in a java servlet using the suggested PareparedStatement class. It is currently inserting inventory data into a SQL Server database of an accounting system. I have two problems. Because the insert statements insert data into 3 different tables, should I move these sql statements to tsql ...

Is it possible to call subclasses' methods on a superclass object?

Hi, sorry for such a novice question, just wanted to check my answer as I think it might be wrong :S Animal is a superclass of Dog and Dog has a method called bark public void bark() { System.out.println("woof"); } consider the following Animal a = new Dog(); if (a instanceof Dog){ a.bark(); } What will happen? the assignment i...

Is it possible to use Axis 2 wsdl2java to generate client side code that uses HTTPS?

Using the default parameters, the axis 2 wsdl2java tool takes as input a wsdl file and generates a client side Java code that communicates with the SOAP endpoint using the HTTP protocol, like in the example below: wsdl2java -uri MyService.wsdl What I would like to know is if there is an input parameter that can be passed to wsdl2java ...

Python-like list comprehension in Java

Since Java doesn't allow passing methods as parameters, what trick do you use to implement Python like list comprehension in Java ? I have a list (ArrayList) of Strings. I need to transform each element by using a function so that I get another list. I have several functions which take a String as input and return another String as outp...

How to learn game development?

I've been a web programmer for a while and I can also program in Java. I have an idea for a small, multiplayer RPG game that I want to work on. It will be played through a java applet in the user's web browser. I have written the design document and specifications of the gameplay. What I'd like to know now is how I can develop the game?...

Alternative to javax.activation.MimetypesFileTypeMap().getContentType(filename);

I have some code: import javax.activation.MimetypesFileTypeMap; ... .. . String filename = "foo.xls"; // Where this can be any file name .doc, .pdf or whatever String headerContentType = new MimetypesFileTypeMap().getContentType(filename); It seems javax.activation.MimetypesFileTypeMap class is inside rt.jar which comes with JRE Sys...

Hibernate calls flush on find- causes not-null error

Hi I have a process which updates a tree to the database, and in doing so, performs reads to check for duplicates entities. I'm finding that trying to do a criteria.uniqueResult() midway through this process causes the following error: org.hibernate.PropertyValueException: not-null property references a null or transient value ...

Calling System.gc() in mobile

I have to maintain a j2me application. There is a lot of System.gc() inside the application. Before calling System.gc() all the attributes are setted to null. Does setting attributes to null make sense? Does calling System.gc() make sense? Shouldn't the jvm call the garbage collector when is necessary? ...

Connecting to a VPN without installation of client software

I must sometimes write software to establish a socket with a particular server residing within a Cisco VPN. I simply write my software as if there were no VPN (making use of the standard sockets library). When it is time to run this program, I manually connect to the VPN using the client software installed on my computer, then run the pr...

Java enums in MIDP 2 mobile application

I've just got back to MIDP development after some 4 years of .NET 2 and Java 5 and 6. During that time I got to like using enums quite a lot. Enum is a language feature that allows a developer to have more confidence in some parts of his code, specially for being able to avoid or detect errors earlier (during compilation). Some other ad...

In Java, why super-class method can't access protected or private methods/variables from sub-class instance?

Let's start from another behavior: even if you declare method/variable as private, another instance of the same class can access it. It's OK I can live with it. I call these class private and not instance private. Now the question part: For example, in runtime I want to be able to check that all String variables in this class are not nu...

Suggestions for software architecture style to use between Java and Windows

Here is an interesting combination, I need to transfer data between an "appliance" running Windows XP Home and a remote Linux server on the internet. Let me itemize what needs to happen: The "xp home" system needs to transfer data or files every 30 minutes or so. (sftp?) The Linux server need to contact the "XP Home" system to request...

JFrame in Java

Hi, I am using a JFrame as a pop-up from a main frame, where the user is supposed to enter some information and then press OK. But the problem is that once this sub-frame has opened up, I want the program to ignore any other signal until the OK button is pressed, similar as how it is done with JOptionPanes. As it is now, you could click ...