Skip to content

Tag: java

Mapping array with Hibernate

Can you please help me to map this class using Hibernate? I’m using PostgreSQL and the column type in the table is integer[] How my array should be mapped? Answer I have never mapped arrays to hibernate. I always use collections. So, I have slightly changed you class:

Android Resource – Array of Arrays

I am trying to implement a resource data structure that includes an array of arrays, specifically strings. The issue I run into is how to get the sub-array objects and their specific values. Here is what my resource file looks like…. Then, in my Java code I retrieve the array and try to access the sub e…

Best way to parseDouble with comma as decimal separator?

Because of the comma used as the decimal separator, this code throws a NumberFormatException: Is there a better way to parse “1,234” to get 1.234 than: p = p.replaceAll(“,”,”.”);? Answer Use java.text.NumberFormat: Updated: To support multi-language apps use:

Is there a maximum size to char[]?

IN JAVA Is there a maximum size of char[]? Can I have a char[5,000,000]? Is array in java composed of contiguous memory blocks? Answer Since the index is int based the maximum size of an array should be Integer.MAX_VALUE Obviously the other limit is the amount of memory available to your application 🙂

autocomplete in vaadin?

I’m new to vaadin. How do I do autocomplete (actually, more like google suggest) on a huge set of data that cannot be loaded in memory, but instead performing a JPA query on every key event. Is it possible to capture key events on a textfield or combobox? Answer You could check out Henrik Paul’s S…

Java IOException “Too many open files”

I’m doing some file I/O with multiple files (writing to 19 files, it so happens). After writing to them a few hundred times I get the Java IOException: Too many open files. But I actually have only a few files opened at once. What is the problem here? I can verify that the writes were successful. Answer…