java

Hibernate second-level cache ehcache.xml, the cache setting for entities can't be read to HIbernate

To make it clear and easy, I have two projects: 1. An Entity project where there are all the entity classes in this project. 2. An project that contains a main() function to run the application, My ehcache.xml is placed in the class path of this project. My problem is: I can change the defaultCache element of ehcache.xml and I can see c...

Changing value after it's placed in HashMap changes what's inside HashMap?

This is a Java related question. If I create a new HashMap and a new List, and then place the List inside the Hashmap with some arbitrary key and then later call List.clear() will it affect what I've placed inside the hashmap? The deeper question here being: When I add something to a hashmap, is a new object copied and placed or is a ref...

Changing NumberConstants.decimalSeparator() value

I'm working with NumberField and NumberFormat. How can I change NumberConstants.decimalSeparator() value without changing my locale? For instance I want to have "." or "," as decimal separators for all locales. Is it possible to create custom property file NumberConstants_bla.properties and force gxt use it instead of standard NumberCons...

How to Decompress the data using GZIP in java if the data is compressed with the same in BlackBerry

I have written a sample program to compress and decompress data using GZIP in blackberry. This program works fine. I have written a sample program to compress and decompress data using GZIP in Java. This program also works fine. But if I compress the data using BlackBerry. I am unable to decompress the data in java. How to overcome fr...

BeanPropertySqlParameterSource and Doubles

Have a table and a sproc setup in Sybase as follows: create table testtab (f float) create proc insert_testtab @f float as insert testtab values(@f) And a java object that holds a Double class TestObj { Double getF() { return 12.34; } } Using SimpleJdbcCall & BeanPropertySqlParameterSource: SqlParameterSource params = new BeanPrope...

JNA Passing Structure By Reference Help

Hi all, I'm trying to use JNA to talk over a USB device plugged into the computer. Using Java and a .dll that was provided to me. I am having trouble with the Write function: C code: typedef struct { unsigned int id; unsigned int timestamp; unsigned char flags; unsigned char len; unsigned char data[16]; } CANMsg; ...

Efficient way to implement paged SQL result table in a Java desktop application

Hi all, I need to build a table from SQL select result set. I want to add some paging functionality to the table because the result set can be very large. There was many discussions how to do the paging at the SQL level. But how to implement the paging at the GUI level? I have two ideas: Do the paging in a web UI style - for example g...

Solutions for document generation in a Java server app

I've been looking at various pdf generating libraries for use a Java based application. The primary requirement is produce letters and insurance documentation. Ideally the design of the documents should be quite easy to change, with out a new release of the code. So far I've looked at: Jasperreports - solid library used it before, not...

Convert String to code in Java

I want to know if there is any way to convert a String to Java compilable code. Explanation: I have a comparative expression saved in a database field. I want to retrieve it from database, then evaluate it inside a conditional structure. Is there any way to do this? ...

BIRT / WebSphere / Java 2 Security

Has anyone managed to get BIRT to run under WebSphere with Java 2 Security switched on? Doesn't seem to matter what I put in my was.policy file, I get a huge number of security exceptions when I try to produce a report. Running with Java 2 Security switched off works perfectly, but that's not an option for the production environment. A...

How to make unique font color for lines in a JCombobox?

I want to set the font color for the lines/entries in a JCombobox, unique for each line. So basically when you click the dropdown arrow, you should see a few lines that are different colors, and I want to specify the colors myself based on their properties. How should I go about doing this? Thanks! ...

Lightest-weight spacer component in a GridBagLayout

In a GridBagLayout, what component is the best for providing empty space in a panel? Ideally I would like to use a component that has: Low overhead No side effect when no empty space is required (i.e. no minimum size) A trivial constructor (no parameters) A JPanel violates #2 above. A Box requires a constructor parameter (#3 above)...

Need to sum up fields of objects in objectarray, all within the constructor?

I have two classes, one for articles and another for the cart. the cart consists of an object-array, filled with articles. I need to sum up the prices of the articles with a foreach-loop within the constructor. When i write the method (that is probably wrong) within the constructor than its type is not accepted as double. How can i sum ...

How can I access a config file from a servlet deployed as a .war-file and running in Tomcat 5.5?

I'm trying to access a config file from a a servlet inside of .war-file. The problem is, that the default file path is the tomcat root itself and hardcoding the path to the file seems not like an option either. Is it possible to get any information through the ServletContext or any Tomcat variables? ...

JNI Calls different in C vs C++?

Hey Folks, So i have the following code in C that utilizes Java Native Interface however i would like to convert this to C++ but am not sure how. #include <jni.h> #include <stdio.h> #include "InstanceMethodCall.h" JNIEXPORT void JNICALL Java_InstanceMethodCall_nativeMethod(JNIEnv *env, jobject obj) { jclass cls = (*env)->G...

Java: Deriving from a generic List/Collection

Hi folks, I have a little problem understanding the Java language public class PhonebookEntryList extends List<PhonebookEntry> { public PhonebookEntryList(String filename) throws IOException { //loadListFromFilename(filename); } public void saveListToFilename(String filename) throws IOException { //Do som...

How can I avoid ResultSet is closed exception in Java?

As soon as my code gets to my while(rs.next()) loop it produces the ResultSet is closed exception. What causes this exception and how can I correct for it? EDIT: I notice in my code that I am nesting while(rs.next()) loop with another (rs2.next()), both result sets coming from the same DB, is this an issue? ...

Conditionally Render In JSP By User

I'm trying to make a simple forum just to get the hang of the Spring Security and MVC frameworks. For simplicity's sake, let's I have a JSP to view a forum post, which looks like the following: <body> ... Title: ${forumPost.title} <br> Author: ${forumPost.author.name} <br> Message: {forumPost.message} <br> <securi...

How to dynamically build JDO Queries on multiple parameters

One can easily use JDO syntax to query on multiple parameters as follows: //specify the persistent entity you're querying and you filter usign params query = pm.newQuery(MyClass.class, " customer == paramCustomer && date >= paramStartDate && date <=paramEndDate "); // declare params used above query.declareParameters("com.google.appeng...

Calling JAX webservices from php is not working

Hi, I am trying to call Java webservices developed using JAX-WS 2.1.4 from php but it doesnt seem to work as expected. All the parameter values being passed to the method has been intrepreted as "null" value, but i am passing the proper values from php side. Can anyone please help me on this? Thanks, Mani ...