java

Message Driven Beans - Single Bus, Multiple Activation Specs

I have 2 Message driven beans. 2 Activation Specs for these beans. I have one Message bus and both the activation specs are configured to this one bus. I have 2 different queues and one queue connection factory configured for that one Message bus. Now, I would write my code to send a message to one of the queues at runtime after determ...

Problem with preparedStatement

Excerpt from code PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM sch.tab1 where col1 like lower ( 'ABZ' ) "); preparedStatement.executeQuery(); The above code executes successfully. But when i try to execute this PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM sch....

Swing: What is a good way to implement fully-scalable components?

I am creating an application which has a scrollable and scalable (zoomable) view. Inside this view I want to place other components (most of them customized JPanels and JInternalFrames). Things such as fonts and borders, and sub-elements such as buttons don't need to be scalable. Only dimensions and position of container components shou...

What is best book for learning rest ?

What is best/good book to learn REST ? Same time looking good REST framework in java or groovy. ...

What is the easiest way to track a change in a folder in Java ?

I have a set of source folders. I use a Java class to build the distribution file out of these folders. I'd like to write another little class in Java which runs every half a second, checks if any of the files in the folders have changed, and if yes, run the building class. So, how do I detect easily that a folder has been modified ? ...

Eclipse Plugin - Popup Menu Extension

Hi All, I am trying to add a new menu item to Eclipse's popupmenus. It really seemed straightforward enough in the examples and tutorials but the menu item itself is never visible. I expect this to work in all views and for basically anything that is a file. I am using Eclipse 3.4. This is the my plugin.xml configuration: <?xml version...

Multiple .class files generated for a class?

Out of curiosity, why are sometimes multiple Java .class files generated for a class after compilation? For example, my application has six classes. For one class, a total of 10 .class files has been generated, starting from MyClass#1 up to MyClass#10. ...

What does combineaccessrules mean in Eclipse classpaths?

This has been bugging me for years now, and I thought one of you fine people would know - in Eclipse's .classpath files, what is the combineaccessrules attribute of the classpathentry element actually used for? I can see in the Java Build Path config dialog that it can be maniuplated, but I can't think of a good use case for it. If I m...

Unmarshalling collections in JaxB

Hi, suppose I have this class: public class A { private HashMap<String, B> map; @XmlElement private void setB(ArrayList<B> col) { ... } private ArrayList<B> getB() { ... } } When trying to unmarshall an xml document to this class using JaxB I notice that instead of calling the setB() method...

Long running methods from Java SDK for testing purposes

I'm working through some tutorials and examples of java.util.concurrent package. Usually example authors put a placeholder marked with a comment 'long running task'. Since these examples are about concurrent programming I'm not keen of using Thread.sleep(long), surrounded by try-catch blocks. What do you use in these circumstances? To ...

What is a good (natural-language) naming scheme for interfaces (Java, C#, ...)?

Hello! NOTE: This is not the popular interface naming question about using or not using "I" at the beginning. I encounter often the problem to name an interface, which indicates a belonging or property of a class. (Please see following list) Let's brainstorm, what kinds of interfaces are there? Indicate the "kind" of a class DataStr...

benchmark and the cause for difference between c# and java

I have a puzzling situation and I would need an expert opinion as to the cause of the phenomenon explained below. A couple of weeks ago, I have conducted a session titled "An overview .NET for Java developers" and as a part of it I wrote a quick class C# (3.5 framework) to read from a file and write to another file line by line (in an i...

What is the proper JPA mapping for @Id in parent and unique sequence in base classes

I have a class hierarchy: abstract DomainObject { ... @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ") @SequenceGenerator(name="SEQ",sequenceName="SEQ_DB_NAME") @Column(name = "id", updatable = false, nullable = false) private Long id; ... } BaseClass extends DomainObject { ... // Fill in ...

String to Array and Back : PHP

In PHP I have a string, how do I convert it to an array? After manipulating that array, how do I again make it into a string? Do strings in PHP behave the same way as in Java? is there a dupe for this? thanks in advance ...

Does anybody know what encrypting technique is JDeveloper/SQL Developer using to persist credentials?

I'd be more than interesting for me to understand which technique is being used here to persist sensible data since I'm needing to implement a similar solution. Here's a sample connection configuration and the resulting exported snippet: <?xml version = '1.0' encoding = 'UTF-8'?> <References xmlns="http://xmlns.oracle.com/adf/jndi"&g...

What libraries are there for processing XML on Google App Engine/Java Servlet

I'm writing a Java servlet in Eclipse (to be hosted on Google App Engine) and need to process an XML document. What libraries are available that are easy to add to an Eclipse project and have good example code? ...

Strange 404 error using spring mvc

This is a long shot but hopefully someone can help. My application is using spring framework mvc. 99% of if works properly. However when I attempt to go to one link lets call it [path]/link.html. I get a 404 error. If however, I go to this link within my development environment (tomcat,windows,IE and eclipse) I get no such 404 error...

Can java call parent overridden method in other objects but not subtype ?

here is java code class Cup { public String sayColor() { return "i have a color ."; } } class TCup extends Cup{ public String sayColor(){ System.out.println(super.getClass().getName()); return super.sayColor()+"color is tee green."; } } class MyTCup extends TCup { public String sayColor(){ Syste...

Save information between tasks in Ant build scripts

Hey In am writing a Java API for an SMS gateway, and I have some trouble with my ANT build script. Basically what I would like to do is to be able to only specify the username and password for the service in one place in the build file but be able to call the task that sends an SMS from anywhere in the build file. What I have now is th...

Type problems with native Java classes.

Hello, I have the following problem, maybe someone can help me (or explain, where my mistake is). Given are a trait and a class: trait TextAttr[T <: {def setText(s:String); def getText : String}] { val obj : T def txt_= (s:String) = obj.setText(s) def txt = obj.getText } class ScalaText { private var t = "" def setText(s:Str...