Hi,
How can I generate insert statements like insert into table (sequence.nextval, 'b0) using hibernate?
Hibernate currently selects the sequence.nextval value and only then it uses the value to insert the entry in the table.
Note: I'm not very fond of custom id generators.
...
I'm trying to figure out how to upload one file using GWTs FileUpload widget. I'm using GWT and Google AppEngine with Java but I would like to upload file to my own Linux server.
I have the following code already but now I can't figure out how to submit my file to the Google AppServer server and save it to another server:
public class ...
What's the best way to insert statistics symbols in a JLabel's text? For example, the x-bar? I tried assigning the text field the following with no success:
<html>x̄
Thanks.
...
So, I've got a design question: I have several processes running that are updating my database. As an example, imagine a banking system, where I'm recording transfers from one account to another. In this case, I have to subtract the transfer amount from the source account and credit the same amount into the destination account as a singl...
I have been reading through the documentation for neo4j and it's components and have yet to come across functionality that lets me query the total number of primitives (nodes, relationships, and properties) in the graph. Does this functionality exist somewhere or am I going to have to write code that traverses the entire graph counting a...
EDIT
Thanks for the promptly responses. Please see what the real question is. I have make it bold this time.
I do understand the difference between == and .equals. So, that's not my question ( I actually added some context for that )
I'm performing the next validation for empty strings:
if( "" == value ) {
// is empty string
}...
I'm trying to map entities of the same class (MyData) to each other through a mapping table. MyData has a composite primary key (id1 and id2). When I create the class (see below), it seems like Hibernate is reversing the order of the FK mappings (i.e. a_id1 is pointing to b_id2, etc...). This does not seem right. Does the inverseJoi...
I was wondering if anyone tried using JMockit Hibernate Emulation?
Jmockit documentation says that when Hibernate Emulation tests are run, they won't use the O/R mapping information. So, this means it doesn't test O/R mappings, HQL query strings, Native queries, etc. Then what really are the benefits of Hibernate Emulation? One can jus...
Hi there, I'm writing a Java application that will instantiate objects of a class to represent clients that have connected and registered with an external system on the other side of my application.
Each client object has two nested classes within it, representing front-end and back-end. the front-end class will continuously receive da...
Any suggestions on how I can cleanup the following code pattern that repeats multiple times in my app.
new Thread(new Runnable() {
public void run() {
// Do some work here
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Update the Swing Interface to reflect the change
}
});
}
}).st...
In my Java code I have function that gets file from the client in http request and converts that in to the file. I have this line there:
byte[] buffer = new byte[8192];
what does 8192 bytes (8 kb) means here?
This is one of the responses that I got, and want to make sure that I understand that code.
...
Freemarker has the ability to do text escaping using something like this:
<#escape x as x?html>
Foo: ${someVal}
Bar: ${someOtherVal}
</#escape>
xml, xhtml, and html are all built in escapers. Is there a way to register a custom written escaper? I want to generate CSV and have each individual element escaped and that seems like a good ...
I use the following code try to create an array of string vectors, I hope to have an array of 3 items, each item is a string vector :
Vector<String> Result_Vector_Array[]=new Vector<String>[3];
But NB highlighted the line as error(generic array creation), what's wrong ? What's the correct way to do it ? I know there is also Arraylist,...
I am building a build script for our web development team. We will be using this script to prepare all our front-end code for production. I am using the YUI Compressor to compress our CSS and JavaScript files. Everything works fine for the CSS portion but I am running into an issue the JavaScriptCompressor class instance.
I am importing...
Hi everyone,
I'm a newbie on Java EE and got a problem that I don't understand why it's happening.
Here is my problem :
I can't access a JavaBean using <jsp:getProperty> which is created in a scriptlet in the same page.It's throwing the below exception :
Attempted a bean operation on a null object.
Here is my bean and jsp page :
pac...
I know that 2d arrays are arrays of arrays. To get a row you can do:
rowArray = my2Darray[row]
Since each row can be a different size, I'm assuming it's not built in to get a column from a 2D array. It leads me to believe you'd have to do something like:
for(int row = 0; row < numRows; row++)
{
colArray[row] = m2Darray[row][colum...
One of the most difficult things about understand Spring is that Spring supports multiple approaches to the same problem.
So in my application I using injected EntityManager using the @PersistanceContext annotation, for example:
@Repository
public class JpaDao extends JpaDaoSupport implements Dao {
@PersistenceContext(unitName = "...
I am trying to port this algorithm to clojure.
My code is
(defn calc-iterations [x y]
(let [c (struct complex x y)]
(loop [z (struct complex 0 0)
iterations 0]
(if (and (< 2.0 (abs z))
(> max-iterations iterations))
iterations
(recur (add c (multiply z z)) (inc iterations))))))
...
I'm using jmock to mock out an OutputStream and set expectations on the data that gets written to it.
So I have an expectation that looks something like this
oneOf(stream).write(byteArrayMatching("Some string"));
(byteArrayMatching) is a factory for a custom matcher.
This all works fine, except when the test fails because the class ...
I'm trying to use JMX API to get active session counts for a web application.
Is it possible to use JMX API to get this kind of information?
If yes, how reliable would it be?
Any example code on how to get this done?
I've been reading JMX tutorial and documentation, but they are giving me the overview of what the technology is. I j...