I have an unowned relationship in my Domain model
@Entity
public class A {
@Id
private String id;
private Key firstB;
private Key secondB;
// getters & setters
}
@Entity
public class B {
@Id
private Key id;
private String name;
// getter & setter
}
KeyFactory.createKey(B.class.getSimpleName(), name) is the way I generate th...
When I first moved from c to Java I thought that I've finished will all the annoying parameter checks in the begining of every function . (Blessed exceptions)
Lately I've realized that I'm slowly moving back to that practice again , and I'm starting to get really annoyed with all the
if (null == a || null == b || null == a.getValue() ...
I've a strange and new issue with an eclipse 3.5 rcp application: Everything worked fine, then I changed the running system and moved a single class from one plugin to a dependent plugin. No big issue, but all of a sudden the application complains with a class not found exception (or NoClassDefFoundError - don't know exactly but will loo...
Let's say you have a million entities persisted into the database.
You want to fire your Drools rules on each persisted entity in order to check on what to do next with them.
What would be the preferable way to do that? Would you prefetch data according to the rules (which would mean that you tie your DAO to your rules), or would you ju...
Hello,
I am using eclipse 3.5 with JBoss inside.
There is one project that we are currently working on.
The problem is that when I deploy the project it reports an exception:
org.jboss.deployers.spi.DeploymentException: Exception determining structure: AbstractVFSDeployment(EAR.ear)
with a nested exception:
java.lang.RuntimeExcept...
Hi,
I am using the Zip utility package of Java and wanted to know how to create a zip file with no compression at all. Setting the level to 0 doesn't help. Is this right?
Also, when I used the 'STORED' method, it throws following exception:
java.util.zip.ZipException: STORED entry missing size, compressed size, or crc-32
I can set ...
Is there any way to find out the number of objects that gets created?
For example,
If I need to find the number of objects that gets created for the below piece of code, how can I get it done?
Code:
String [][] str = { {new String("A"),new String("B"),new String("C")}, {new String("D"),new String("E")} };
...
In this interview, Dan Pritchett mentions a book on Java Axioms, but he can't remember the name. Anybody know which one he's talking about?
...
I am using spring MVC and would like to expose default validator for javascript to use.
I have a bunch of controllers extending a common abstract class and bunch of validators implementing a common interface. The situation is something like this:
public abstract class AbstractController {
protected Validator validator;
}
public class ...
This is the example from the spring 3.0 reference:
<bean id="numberGuess" class="org.spring.samples.NumberGuess">
<property name="randomNumber" value="#{ T(java.lang.Math).random() * 100.0 }"/>
</bean>
<bean id="shapeGuess" class="org.spring.samples.ShapeGuess">
<property name="initialShapeSeed" value="#{ numberGuess.randomNumb...
Hey all,
In a recent question asked recently my simple minded answer highlighted many of my misconceptions about Java, the JVM, and how the code gets compiled and run. This has created a desire in me to take my understanding to a lower level. I have no problems with the low level understanding like assembly how ever bytecode and the...
I'm using an ICEFaces application that runs over JBOSS, my currently heapsize is set to
-Xms1024m –Xmx1024m -XX:MaxPermSize=256m
what is your recommendation to adjust memory parameters for JBOSS AS 5 (5.0.1 GA) JVM 6?
...
Does Java support controlling the cursor when outputting to a console? For example, I'd like to set the character position, and possibly color, before doing a System.out.print(). Think of the way an application like top writes to the console. Thanks!
...
I have a database table with a field that I need to read from and write to via Hibernate. It is string field, but the contents are encrypted. And for various reasons (e.g. a need to sort the plain text values), the encrypt/decrypt functions are implemented inside the database, not in Java.
The problem I'm struggling with now is finding ...
Hi,
I am trying to read(append incoming data into a local String) from a PrintStram in the following code block:
System.out.println("Starting Login Test Cases...");
out = new PrintStream(new ByteArrayOutputStream());
command_feeder = new PipedWriter();
PipedReader in = new PipedReader(command_feeder);
ma...
We are running Eclipse over QNX6 in a VMWare environment and it's very slow.
Eclipse is launched like this:
/usr/qnx630/host/qnx6/x86/usr/qde/eclipse/eclipse -data /root//workspace
/usr/qnx630/host/qnx6/x86/usr/qde/eclipse/jre/bin/pvm -pri 13 -ts 4 -gs 4
-gcperiod 500 -cs 512000 -nojit -numregs 64 -maxmem 256M -Djava.version
-classp...
For a project that I'm working on, I need to implement Burrows-Wheeler's MoveToFront transformation in O(n) space. For some reason, though, my code works on most values that I throw at it, but not all.
My implementation looks something like this:
public byte[] transform (byte[] input)
{
if (input.length == 0)
return input;...
Hi,
Im trying to create an application which can fire-up felix,
and also publish services to the 'Declarative Services' bundle.
But with my 'felix-starter' and services effectively being inside the same jar.
i assume the jar containing both the osgi-host(Felix) and misc. services should contain
the xml file describing the provided/re...
I'm writing a java servlet that calls a function in a jar. I have no control over the code in this jar. The function being called wants the filename of a configuration file as an argument.
I'd like to bundle this file with my war file. If I put it in the war somewhere, what filename can I pass the function in the jar?
Note that only a ...
Hi,
I have created a project in java project using NetBeans IDE. I have few forms in it. The netBeans created a Jar file by its own. when i try to run that Jar file its give an error "Failed to load Main-Class manifest attribute from". I Have set my Starting form in application and when i run from netbeans its running correctly but when...