java

How to get Hibernate session inside a Hibernate Interceptor?

How to get Hibernate session inside a Hibernate Interceptor? I'm trying to use Hibernate to enforce data access by organization id transparently. I have set a global Filter to filter all queries by organization id. Now, I need to use an Entity interceptor to set Organizational Id on all Entities before Save/Update. The organization id...

Java: export to an .jar file in eclipse

Im trying to export a program in eclipse to a .jar file. To my project in I have added some pictures and pdf. When im exporting to jar file, it seems that only the main has ben compiled and exported. My will is to export everything to a jar file if its possible becaus then I want to convert it to an extrakteble file, like .exe-file. But...

Java rounded Swing JButton

Hi everyone, Well, I have an image that I would like to put as a background to a button (or something clicable). The problem is that this image is round, so I needed to show this image, without any borders and etc. The JComponent that holds this button have a custom background, so the button really need to only show the image. After s...

Reserved words as variable or method names

Is there any tricky way to use Java reserved words as variable or method names? ...

How do I output the name, file type and file extension of an xml to another xml

Hi folks, I have a java class that applies an xslt to all xml files in a directory and performs a transformation on every xml it finds and prints out the complete filename. My question is how would I create an xml (Files.xml),which would have the following format, and then ouputs the file name, file type and file extension to Files.xml...

Suggestions for an embeddable scripting language for iPhone and Java app?

I'm developing an app for iPhone with a Java desktop companion that it synchs to over the network. I'd like to embed a scripting language into both apps so that end users can write scripts that add new behaviours and interact with the object model, and so that I can more rapidly develop some features. Any suggestions for this, or anyone...

How do I generate RTF from Java?

Hi, I work on a web-based tool where we offer customized prints. Currently we build an XML structure with Java, feed it to the XMLmind XSL-FO Converter along with customized XSL-FO, which then produces an RTF document. This works fine on simple layouts, but there's some problem areas where I'd like greater control, or where I can't do...

how to convert a string into TimeSeriesDataItem

I am using Jfreechart. I have the following code: TimeSeries t1 = new TimeSeries("EUR/GBP"); t1.add(new TimeSeriesDataItem....); But my SQL query gives date in String format & value in Double. I want to use TimeSeriesDataItem. Please let me know how to convert my String into TimeSeriesDataItem. Please let me know how to add my double v...

Spring and Hibernate, Lazy initiation problem

Hey I am developing an desktop application using Spring and Hibernate, and I have a problem with lazy initiation. I looked in the web and every solution is related to the open session in view pattern, but I can't use this pattern. I've also tried to get the sessionfactory from the HibernateTemplate, but it returns to me a disconnected se...

Are there any Java VMs which can save their state to a file and then reload that state?

Are there any Java VMs which can save their state to a file and then reload that state? If so, which ones? ...

Any satisfactory approaches to unit testing thread safety in Java?

I am looking at improving a package that I believe not to be threadsafe when its input is shared between multiple worker threads. According to TDD principles, I should write some tests that fail in the first instance, and these would certainly be useful in assessing the problem. I realise that this is not a simple thing to acheive, and...

Parsing datetime in Java

I have dates in the format 2008-12-23T00:00:00Z. This look a lot like a ISO 8601 format with a Zulu (UTC) timezone. I though the following code would parse it (using commons-lang) : String pattern = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(); Date d = DateUtils.parseDate(dateToParse, new String[] { pattern }); If I tak...

How to get symbol files for java application when I analyse system crash core dump files?

This is a java application running on Websphere application server. When I analyse the system crash core dump file, I get some info like this: ERROR: Symbol file could not be found. Defaulted to export symbols for J9THR23.dll How can I get symbol files for java applications? Thanks in advance. More details are here: * Exception...

how to plot day-wise chart using Jfreechart

I have data for every 15 minutes. I want to plot a graph to display values from 'date1' to 'date2'. The plot should show every 15 minutes value. But display on X-axis should show only dates. ...

How to use HTML in LifeRay ShoppingItem description?

How can I embed HTML into the ShoppingItem database table "description" field in such a way that it will display on screen? It used to work in older versions, but in the current version it mangles/safes it to display the HTML tags, rather than passing them through to be processed. Is there an alternate method to achieve the desired eff...

Any good graphing packages for Android?

With android removing the Swing and AWT libraries from Java, I was wondering what solutions have been developed to display simple bar histograms, line graphs and other simple data visualizations in Android? There is a Google specific 2D library, was just wondering if there were any packages built atop it that allows for the easy creatio...

Painting a Canvas in an Applet

Hi all, I currently have a small Java program which I would like to run both on the desktop (ie in a JFrame) and in an applet. Currently all of the drawing and logic are handled by a class extending Canvas. This gives me a very nice main method for the Desktop application: public static void main(String[] args) { MyCanvas canvas = ...

GWT vs Flex vs ?

My company is trying to migrate away from a .NET application to something that is purely web-based, and very "ajaxy". The original .NET app is fairly interactive, roughly equivalent to Google Maps as far as user interaction is concerned (zoom, pan, annotate features on a vector map). Our .NET developer is really taken with Flex2. I'll...

MATLAB Java referencing problem

I have a MATLAB class which contains a reference to a java object classdef MyClass properties j = myJavaClass end methods ... end end and after I use it (using clear, scope exit or explicitly setting myClass = 0; ) the java object is still alive - even after calling Runtime.gc. I see in the dump that the object is still i...

Starter guide for Apache ServiceMix

What is the definitive guide to start with Apache ServiceMix? The howto's and guides on the website are way too complicate for a clean start. ...