java

HQL querying columns in a set

Is it possible to reach the individual columns of table2 using HQL with a configuration like this? <hibernate-mapping> <class table="table1"> <set name="table2" table="table2" lazy="true" cascade="all"> <key column="result_id"/> <many-to-many column="group_id"/> </set> </class> </hibernate-mapping> ...

How to make embedded servlet engine instantiate servlets eagerly?

The problem is simple, but I'm struggling a bit already. Server server = new Server(8080); Context context = new Context(server, "/", Context.NO_SESSIONS); context.addServlet(MainPageView.class, "/"); context.addServlet(UserView.class, "/signup"); server.start(); That's a pretty standard piece of code that you can find anywhere in J...

Eclipse RCP app fails to start

I have an Eclipse RCP app running on Java 6. When I try to run the product configuration from within Eclipse, it silently terminates almost immediately. No error is reported in the console. I've tried setting breakpoints in the IApplication and in the Activator, and neither are reached. I know I don't have much specific information h...

Formatting a long timestamp into a Date with JSTL

I am pulling a long timestamp from a database, but want to present it as a Date using Tags only, no embedded java in the JSP. I've created my own tag to do this because I was unable to get the parseDate and formatDate tags to work, but that's not to say they don't work. Any advice? Thanks. ...

How do i pass an object to a JSP tag

I have a JSP page that contains a scriplet where i instantiate an object. I would like to pass that object into the JSP tag without using any cache. For example i would like to accomplish this: <%@ taglib prefix="wf" uri="JspCustomTag" %> <% Object myObject = new Object(); %> <wf:my-tag obj=myObject /> I'm trying to avoid dir...

JPA Multiple Transaction Managers

i have one applicationContext.xml file, and it has two org.springframework.orm.jpa.JpaTransactionManager (each with its own persistence unit, different databases) configured in a Spring middleware custom application. i want to use annotation based transactions (@Transactional), to not mess around with TransactionStatus commit, save, and ...

Using Spry inside Java Server Faces framework

I'm trying to insert a Spry accordion into an already existing JSF page using Dreamweaver. Is this possible? I've already tried several things, and only the labels show up. ...

Java 1.6 JDK tool, VisualVM

Has anyone used the new Java 1.6 JDK tool, VisualVM, to profile a production application and how does the application perform while being profiled? The documentation say that it is designed for both Production and Development use, but based on previous profiling experience, with other profiling tools, I am hesitant. ...

Windows Mobile 6 J2SE-scale JVM implementation

Does anybody have experience of a decent J2SE (preferably at least Java JDK 1.5-level) Java Virtual Machine for Windows Mobile 6? If you know of any CLDC VMs, I'm also interested because even that would be better than what we currently have for the platform. ...

What (good) Java RADIUS server libraries are out there?

I've only been able to find two thus far, namely TinyRadius, which itself discourages production use and AXL, which is pay-only. JRadius seems tied to FreeRADIUS, which isn't a library and will need a lot of cajoling to function like one. ...

Get Last Friday of Month in Java

I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Java, but I was wondering if anyone knew of anything more concise or efficient. Below is what I tested with for this year: for (int month = 0; month < 13; month++)...

access to auto increment identity field after SQL insert in java

Any advise on how to read auto incrementing identity field assigned to newly created record from call through java.sql.Statement.executeUpdate ? I know how to do this in SQL for several DB platforms, but would like to know what database independent interfaces exist in java.sql to do this, and any input on peoples' experience with this a...

Find minimal necessary java classpath

Is there a tool to detect unneeded jar-files? For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable. I realize that reflection might complicate things,...

What's the best way to return variables from a syncExec?

In my SWT Java app I often want to return information from inside a Display.syncExec() call. The best way I've found so far to do this is: final ArrayList<Integer> result = new ArrayList<Integer>(); GUI.display().syncExec(new Runnable(){ public void run() { MessageBox mb = /* ... */; /* set up messagebox */ result.add(mb.open...

Open Java *.Class Files

I'm trying to figure out what a Java applet's Class file is doing under the hood. Opening it up w/ Notepad or Textpad just shows a bunch of gobbley-gook. Any way to wrangle it back into a somewhat readable format so's I can try to figure out what it's doing? Environment == Windows w/ VS 2008 installed. ...

How can I prevent Java from creating hsperfdata files?

I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is there any way to stop java from creating these files? ...

How are Integer arrays stored internally, in the JVM?

An array of ints in java is stored as a block of 32-bit values in memory. How is an array of Integer objects stored? i.e. int[] vs. Integer[] I'd imagine that each element in the Integer array is a reference to an Integer object, and that the Integer object has object storage overheads, just like any other object. I'm hoping however ...

persistence.xml not found during maven testing

I'm trying to load test data into a test DB during a maven build for integration testing. persistence.xml is being copied to target/test-classes/META-INF/ correctly, but I get this exception when the test is run. javax.persistence.PersistenceException: No Persistence provider for EntityManager named aimDatabase It looks like it...

Where can I find a good introductory tutorial for Spring?

I am a Java developer but up to now have not had any hands on experience using the Spring framework. Does anyone know of anyone good online tutorials that explain the basics and offer good examples and sample code. ...

eliminating duplicate Enum code

Hi, I have a large number of Enums that implement this interface: /** * Interface for an enumeration, each element of which can be uniquely identified by it's code */ public interface CodableEnum { /** * Get the element with a particular code * @param code * @return */ public CodableEnum getByCode(String ...