java

Hibernate field with custom type changes, but object not marked as 'dirty' for update.

I've got a Hibernate model that uses a custom type to represent boolean fields (ie, model has a 'Boolean' object, but the database writes a 0 or 1 to a TINYINT field. Changing the value of the boolean object from (true to false or false to true) will change the value on the object, but the Hibernate session manager doesn't seem to think...

Getting the unsaved dot on a Swing Mac OSX app with quaqua LAF

I am trying to make it so my app shows the unsaved dot in my swing windows when running on Mac with quaqua LAF. When I say unsaved dot, I mean in mac apps when you modify something, the red dot in the upper left changes from an empty red circle, to a circle that is mostly filled in with a darker red. Is there some flag I can set to ma...

package com.sun.xml.internal.bind.v2.model.annotation does not exist

I'm trying to use a solution for serializing exceptions using jaxb. (http://forums.java.net/jive/thread.jspa?messageID=256122) The class I need to implement for that solution requires referencing the following com.sun classes. import com.sun.xml.internal.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl; import com.sun.xml.in...

JPA join table with more than one entity

Hi, I have an Entity that looks like this: public class NpcTradeGood implements Serializable, Negotiabble { private static final long serialVersionUID = 1L; @EmbeddedId protected NpcTradeGoodPK npcTradeGoodPK; @JoinColumn(name = "npc_id", referencedColumnName = "id", nullable = false, insertable = false, updatable = fals...

What would you tell yourself if you were teaching your past-self Java as your first language?

I am a begining programmer with some old AutoHotkey (scripting language) experience plus basic html. I am reading Code Complete 2nd ed in the bathroom. & I am reading Java How to Program in my class. - It is drab by comparison. I don't want to spend too much time learning things that are, unofficially depreciated or otherwise silly...

Downloading a file over https over java

Hi, Here is a code that I copied from the web /** * A simple example that uses HttpClient to perform a GET using Basic * Authentication. Can be run standalone without parameters. * * You need to have JSSE on your classpath for JDK prior to 1.4 * * @author Michael Becke */ public class BasicAuthenticationExample { /** ...

JBoss WAR Deployment problem (caching problems?)

Hey, I'm trying to deploy my war file on JBoss 4.2.3. This application was working fine and still is working fine (sans the bugfix that I've put into my code). I have made a new war file with a bug fix in it (which involves passing some extra http request params while requesting another app's servlet). However, when I tried to deploy th...

Critique my server design please.

Hi Guys, I am designing a server in java which would be used to trade bonds. This server will act as a mediator between the client UI and the analytical server. The analytical server is the brain, my server will simply interact with it (using tcp sockets) and forward the responses to the client. The server is expected to handle ~500 cl...

How to Print Hexadecimal Numbers in PHP or Java

I need to print some data (a little bit strange formatted). I was writing it in PHP with if ($num%10==9) but it was impossible for me to get correct output. So take a look at this for example. We have x of files in folder. For this example x=36. X is always known. Output should look like this: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e...

Google Docs PDF Streaming is faster than java servlet Stream?

I am trying to serve PDF (useing tomcat server + Servlet normal streaming). The steaming is stable there is no bug and it handling parallel serving. But not as fast as Google DOC PDF Streaming. My Question is how did they do that fast ? What server they use (Apache + PHP)? or Python? Please suggest which technology i can use to speed ...

Why does @SuppressWarnings break my code?

Got this idea from this previous question. http://stackoverflow.com/questions/529085/java-how-to-generic-array-creation Anyway, my code is like this: public class Slice<E> { private E[] data; public Slice(Class<E> elementType, int size) { //@SuppresWarnings({"unchecked"}) data = (E[])Array.newInstance(elementType...

How to invoke a remote program in Java?

Is it possible to invoke an exe on a remote computer, supposing we know the absolute path of the exe where it lies? I have written a client and a server program and am able to get both work as expected when both are running. But now, all I want to do is to invoke the server program from client if server is not running. Seems like defeat...

where is the best place to start learning about servlet/tomcat?

I need to start developing using this technology servlets/jsp with tomcat. I need to get up to speed fairly quick. What would you recommend to get up there fairly quick? No 900+ pages manuals. A good tutorial (even a video lectures) with lots of examples would be perfect. Thanks ...

What is the best encoding for buildin a multilingual java based web application, and why?

Just curious about the the encoding of files (the actual rendered pages). What encoding should they be in to support widest possible language space in a typical jsp type web application. ...

what is the value for main thread priority?

all threads have its priority,so what is the integer value for main thread? ...

Scalable Regex for English Numerals

I'm trying to create a regex to recognize English numerals, such as one, nineteen, twenty, one hundred and twenty two, et cetera, all the way to the millions. I want to reuse some parts of the regular expression, so the regex is being constructed by parts, like so: // replace <TAG> with the content of the variable ONE_DIGIT = (?:one|two...

Exception in thread "main" java.lang.noClassDefFoundError org/jdom/input/SAXBuilder

Hello this is Lonnie Ribordy, I have a program i am trying to write and part of it uses a 3rd party api called JDom, when i compile my program the it compiles perfectly fine.. but, when i try to run it i get the Exception in thread "main" java.lang.noClassDefFoundError org/jdom/input/SAXBuilder my program is as below... import javax...

Problem in generating Java classes from XML schema definition using XJC(of JAXB).

I have an XML that looks like this and a corresponding xsd with it. <books> <book name="book1" id="book1"> <name>Harry Potter</name> ........... </book> ........... </books> Please see that 'name' is appearing twice, once as an attribute in tag, and also as an element under tag. Apparently that is invalid syntax, I am no...

JPA/Hibernate entityManager.persist(..) makes the entity's collection to become null even though they are saved

I have a PurchaseEntity that has a Set inside. After doing entityManager.persist(purchaseEntity), purchaseEntity itself and purchaseItemEntity's are all saved to DB correctly. But after that entityManager.persist(purchaseEntity) call, purchaseEntity.getItems() returns null. Is this a normal behaviour of Hibernate provided entityManager...

When does a Java Thread reach the 'Die' State

In Java, Die is one of the states on a thread. What causes a thread to enter this state? ...