java

Atom/RSS feed for JRE/JDK releases

I'd love to subscribe to an Atom or RSS feed that is only updated to announce when a new version of the Sun JRE/JDK is released. I've always stumbled upon new releases by hitting java.sun.com, but would rather be notified in my feed reader. Is anyone aware of such a feed? ...

How do I convert an InputStream to a String in Java?

Suppose I have an InputStream that contains text data, and I want to convert this to a String (for example, so I can write the contents of the stream to a log file). What is the easiest way to take the InputStream and convert it to a String? public String convertStreamToString(InputStream is) { // ??? } ...

delete hibernate entity without (attempting to) delete association table (view) entry

Entity A and B have a many to many relationship using link table AtoB. If Entity A is deleted, the related links are deleted by hibernate. So far so good. My problem is that my link table is a view hiding a much more complicated relationship and works perfectly in this situation except when hiberate tries to delete the link rows from t...

Oracle AQ dequeue order

A trigger in an Oracle 10g generates upsert and delete messages for a subset of rows in a regular table. These messages consist out of two fields: A unique row id. A non-unique id. When consuming these message I want to impose an order on the deque process that respects the following constraints: Messages must be dequeued in insert...

Oracle AQ Java interface and custom message types

I am using the Oracle Java interface for AQ and want to dequeue messages. These messages consist out of two fields: A unique row id. A non-unique id. I successfully decoded messages using a single RAW payload like this: AQDequeueOption option = new AQDequeueOption(); option.setDequeueMode(AQDequeueOption.DEQUEUE_REMOVE); AQMessage ...

Using Microsoft Access with Java without the JdbcOdbc default bridge

Hi, we have to use in our project some legacy Microsoft Access 97/2000 databases with Java. The problem is: we face many problems with the default JdbcOdbc driver which is available on the JDK (memory leaks are the most common issue). So here is my question: is there any other JDBC Driver we could use (open source whould be great) to a...

NullPointerException at org.hibernate.envers.event.AuditEventListener.generateBidirectionalCollectionChangeWorkUnits(...)

I'm using Envers to audit different fields of my entities. The framework works in general but it seems to have problems with some kinds of entity mapping. All former problems I could solve myself... but this time I'm stuck. When inserting some entity into the database I get the following exception: Caused by: java.lang.NullPointerExcep...

Persisting web service passwords

I'm not a security guy so any help on this would be greatly appreciated. I have a large number of third-party field devices that have remote methods that can be called across xml-rpc using ssl. For each method call, a username and password must be transmitted in plain text as parameters along with any other method parameters. I have no ...

Apparent Hierarchies of Packages

In this post http://java.sun.com/docs/books/tutorial/java/package/usepkgs.html into the paragraph "Apparent Hierarchies of Packages" is written: "" At first, packages appear to be hierarchical, but they are not. For example, the Java API includes a java.awt package, a java.awt.color package, a java.awt.font package, and many others tha...

adding JLayeredPane to JPanel

I am trying to add a JLayeredPane to a JPanel and then add an image (JLabel icon) and a button to the JLayeredPane, but neither show up. I've tested the image without the button and the layeredpane so I know that works. Here is some of the code I am using. Is there something I am missing or doing wrong? public class MyClass extends...

Keep track of the maximum memory use in java profiler

I am trying to detect memeory leak in my java codes with java profilers VisualVM. I want to report the maximum memory usage before and after I fix a memory leak. While running VisualVM or other java profilers, is there anyway to find out the peak of the memeory usage? Thanks! ...

Should I keep the package name when extending a class?

I plan to extend a JSF renderer. The package name is oracle.adfinternal.view.faces.renderkit.rich Should the extended class be in the same package structure: oracle.adfinternal.view.faces.renderkit.rich or even oracle.adfinternal.view.faces.renderkit.rich.[subpackage] or can/should I put it into my own package? com.company.renderkits. ...

Parent with cascaded VersionLockingPolicy not picking up database changes to private owned child objects.

I have a parent object with a version locking policy defined as follows: VersionLockingPolicy lockingPolicy = new VersionLockingPolicy(); lockingPolicy.setIsCascaded(true); lockingPolicy.setWriteLockFieldName("CacheId"); descriptor.setOptimisticLockingPolicy(lockingPolicy); and with a child mapped as follows: OneToManyMapping childMa...

Multi-Dimension length array reflection java

How do I find the length of a multi-dimensional array with reflection on java? ...

Use of Mocks in Tests

I just started using mock objects (using Java's mockito) in my tests recently. Needless to say, they simplified the set-up part of the tests, and along with Dependency Injection, I would argue it made the code even more robust. However, I have found myself tripping in testing against implementation rather than specification. I ended u...

Persistence strategy for low latency reads and writes

I am building an application that includes a feature to bulk tag millions of records, more or less interactively. The user interaction is very similar to Gmail where users can tag individual emails, or bulk tag large amounts of emails. I also need quick read access to these tag memberships as well, and where the read pattern is more or...

how can i insert a image in swing JList menu?

this is my code: URL imageUrl = status.getUser().getProfileImageURL(); ImageIcon tivitImage = new ImageIcon(imageUrl); listModel.addElement(tivitImage.getImage()); // maybe this part is wrong ...

Automated Testing for Oracle APEX Web Application

Good morning, everyone. I'm currently working on a new web application and it's being developed using Oracle APEX. It's basically a ten page wizard-style web form that gets filled out and submitted. In nearly all cases, only three or four of these pages will be used and the other exist to present special-case information to the user. ...

JasperReport exception print

I making report engine with JasperReport. Everything works fine so far but I have small miss understanding. In my code I'm trying to compile template file and return JasperReport object and if the compilation is failed then compile another file and return error message. But it does not work for some reason. Here is my code: /** * Gener...

Java reflection: What does my Collection contain?

Hi guys, I've defined a method in a class: public void setCollection(Collection<MyClass>); and in another class public void setCollection(Collection<OtherClass>); (and really, lots of similar classes) All are in classes with the same superclass, and I have a method in a support-class where I want to call this method and set it wit...