java

Howto return ids on Inserts with Ibatis ( with RETURNING keyword )

I'm using iBatis/Java and Postgres 8.3. When I do an insert in ibatis i need the id returned. I use the following table for describing my question: CREATE TABLE sometable ( id serial NOT NULL, somefield VARCHAR(10) ); The Sequence sometable_id_seq gets autogenerated by running the create statement. At the moment i use the following sq...

How to parse text with delimiters?

Possible Duplicate: How to parse this output and separate each field/word Hi everyone. I want to parse the following data, such that i get the output as specified below. Input: RTRV-ALM-EQPT::ALL:RA01; SIMULATOR 09-11-20 13:52:15 M RA01 COMPLD "SLOT-1-1-1,CMP:MN,T-FANCURRENT-1-HIGH,NSA,01-10-09,00-00-00,,:\"Fan-T\"," ...

combine x-taglib with c-taglib on <x:set> and <c-foreach>

can is use a x-taglib var in a c-foreach like: <x:set var="logrows" select="$doc/properties/entry[@key='foo.bar']"></x:set> <c:forEach items="${bar.foo}" var="log" begin="0" step="1" varStatus="i" end="${logrows}"> </c:foreach> thx ...

How can I write a byte array to a file in Java?

How to write a byte array to a file in Java? ...

How long should I prepare for SCJP?

Ok I know this might sound a bit silly, as it depends on the person, but on average how much time should I spend on preparing for SCJP? I already have some experience with Java (a few small and medium projects for my university, from implementing a simple "ships" game to some client-server stuff). I was thinking about taking it around j...

Serialization of Method object in Java is possible?

I'm getting this error when I try to serialize a Method object. java.io.NotSerializableException: java.lang.reflect.Method Any Idea? ...

How to include Apache Commons IO in Eclipse? (Java)

How can I configure my Eclipse installation to use classes from Apache Commons IO? I want to use this code: IOUtil.write(encoded, new FileOutputStream(new File("target-file.txt"))) But it gives the error: IOUtil cannot be resolved ...

Spring - share web application context between different webapps

Hi, I have a multi-module maven project. One of the modules is a util layer that has some spring beans. I want to share the same spring beans within the other modules. The other modules are deployed as non-related web-applications, so ideally my util beans would be singletons and I would only have one ref to these singletons throughout ...

Where I can find good Spring project example with Hibernate?

I need to make project with Spring + Hibernate, where I could find good example project how basic things are done? ...

Why am I getting null on this code?

This is a part of my source (when I enter a button) of my JDilog form. I have made an object from the SystemManagement class which is management (I have written also some part of this class). When the user add her/his information, with the addStudent() method in SystemManagement class I add her/his information to the student's list but w...

cloning interfaces in Java

Hello I have a problem in Java: I have an interface: public interface I extends Cloneable { } and an abstract class: public abstract class AbstractClass { private I i; public I i() { return (I)(i).clone(); } } but the usage of clone() yields the following error: The method clone() is undefined for the ty...

Will Apache Ant make IOUtil class usable?

Will Apache Commons IO classes be usable if I add Apache Ant to the project build path? I need to use IOUtil class. If no please provide the download link to the correct JAR file. ...

How do I measure time elapsed in Java?

Possible Duplicate: Quick question: Java system clock I want to have something like this: public class Stream { public startTime; public endTime; public getDuration() { return startTime - endTime; } } Which types to use in order to accomplish this in Java? (Also...

Trinidad JSF tr:panelPopup opened by js is not working in IE

I'm using Trinidad 1.2.12. I have a jsp page that has a tr:panelPopup. I need to open the popup in certain cases when the page is reloaded. I tried to do this by placing a panelGroupLayout with the appropiate render attribute. Inside of that panel I have the tr:panelPopup and a js function that calls the function that shows the popup. Th...

Duplicate Elimination

hi every body i have problem with this question Duplicate Elimination Use a one-dimensional array to solve the following problem: Write an application that inputs 10 integers. As each number is read, display it only if it is not a duplicate of a number already read. Use the smallest possible array to solve this problem. Display the co...

How to user Hibernate @Valid constraint with Spring 3.x?

I am working on simple form to validate fields like this one. public class Contact { @NotNull @Max(64) @Size(max=64) private String name; @NotNull @Email @Size(min=4) private String mail; @NotNull @Size(max=300) private String text; } I provide getter and setters hibernate dependencies ...

Log4J: Strategies for creating Logger instances

I decided to use Log4J logging framework for a new Java project. I am wondering what strategy should I use for creating/managing Logger instances and why? one instance of Logger per class e.g. class Foo { private static final Logger log = Logger.getLogger( Foo.class ); } one instance of Logger per thread one instance of Logger pe...

Is ConcurrentHashMap.get() guaranteed to see a previous ConcurrentHashMap.put() by different thread?

Is ConcurrentHashMap.get() guaranteed to see a previous ConcurrentHashMap.put() by different thread? My expectation is that is is, and reading the JavaDocs seems to indicate so, but I am 99% convinced that reality is different. On my production server the below seems to be happening. (I've caught it with logging.) Pseudo code example...

similarity and difference between jpa and hibernate.

what is similarity and difference between jpa and hibernate. ...

When to use the various generic containers in Java

Hello Does anyone know of any resources or books I can read to help me understand the various Java collection classes? For example:When would one use a Collection<T> instead of a List<T> and when would you use a Map<T, V> instead of aList<V>, where V has a member getId as shown below, allowing you to search the list for the element matc...