Jonas Wille

+ Follow
since Mar 29, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jonas Wille

We have a RDB database with one column in utf-8 encoding for Chinese text. Now I want to know how many bytes the text takes. Well, we know how much it takes, but we want to see it in software.

So, I use the getBytes()-method of the ResultSet. For all Chinese characters it returns 2, but I doubt this is correct because when I use the getString().getBytes() of the ResultSet it returns 3 and with the SQL function LENGTHB() the result is also 3.

Finally, I try to make a String from the bytearray that is returned by the getBytes()-method of the ResultSet and compared it with the one that is returned by the getString() from the ResultSet.
If the text isn't Chinese, the 2 Strings are equals. But otherwise they aren't.

Is it possible that the getBytes() method of the ResultSet isn't correct? (Driver is a JDBC-RDB driver)

Hope you can understand what i'm trying to say.


You can always calculate the position from the mouse for the backgroundcomponent.

Something like this could probably do the trick.

9 years ago
I found a solution by myself

I'm currently working on software to represent a JPA Annotated Model. The program needs a JAR-file, with the annotated classes, as input. The JAR-file also contains the persistence.xml for that model.

It's no problem to iterate the JAR and put all the classes to the classpath dynamically.

But the problem is the persistence unit: My question is ambiguous:

1) is there a way to use the persistence.xml file from the JAR with the persistence unit description in my program?
2) can you add dynamically annotated entities to a Persistence Unit without using Hibernate? So that I can use one persistence unit and just add all classfiles from the jar to it.

PS. I'm using Toplink essentials as JPA implementation, but I've tried it with EclipseLink and OpenJPA as well.

Jonas Wille