Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!

Christian Dillinger

Ranch Hand
+ Follow
since Jul 20, 2009
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 Christian Dillinger

Did you change the implementation of your diagonal sums? Because one is wrong... They both return the sum of only one of the diagonals. (Check what fields go into that sum... grid[0][0], grid[1][1], ... , grid[n][n] in both implementations. )
3 years ago
We only use Oracle and PostGIS in production. For hobby projects I use H2 (or plain shapefile datastores or gml), so no need for MySQL.
Have a look at (if you plan to use Postgres/Postgis) or google for "oracle spatial" (if using Oracle). Or if you use Hibernate have a look at to see how spatial queries work within hibernate. Hibernatespatial supports differenz spatial dialects.
Does not work reliably...

The address does not exist.
4 years ago
The import example means that there are two things, both named "Date". By using the import statement you can use only "Date" when declaring a field instead of "java.util.Date" or "java.sql.Date". Just a shorter form. If there are two things with the same name the compiler cannot know which one you want to use. By using "java.util.Date date1" and "java.sql.Date date2" the compiler knows which one to use.
4 years ago

Gabrielle Linkherz wrote:
Well, it's the complete program.. i can compile, but When i want to input "9.8", it said Exception in thread ... at java.util.scanner, bla bla bla ...

Well, that "bla bla bla" is the most important part of the exception...

What int-Value (!) do you expect when you type "9.8"? Try nextDouble() instead of nextInt(). And use the right sign ("," or ".") according to your locale.
4 years ago

Campbell Ritchie wrote:

Christian Dillinger wrote:. . . Do you have two different classes with the name "Vehicle"?

That is not possible. It is possible that there was a spelling mistake in the code which has been corrected in what was posted here however.

I thought about different packages. Many users "forget" to copy that line...
4 years ago
Works here... Do you have two different classes with the name "Vehicle"?
4 years ago
Have a look into the Api Doc what BufferedReader#read does and check if that behaviour is useful to read a name.

=> use readLine() instead
4 years ago
Both declarations declare "locationCell" to be an ArrayList which can contain String. The first is not initialized and is "null" (things like "locationCells.size()" won't work => NullPointerException), the second is initialized and can be used.
4 years ago

sachins patil wrote:

Knute Snortum wrote:If you don't have a package statement, then you can't use the syntax packagea.ClassA syntax. So add this to ClassA:

We can do that.
Explained in book
Oracle certified associate java se8 programmer study guide by jeanne boya
page no-14

No, you cannot do that. If you do not declare the class to be part of a package, it is not part of a package. If you look carefully at page 14 you will find the package-declaration.
4 years ago
Hi all,

as described here ( we use a custom login module within JBoss EAP. Now I'm facing some problems when invoking an EJB that is not part of the security domain.

Short config from standalone-full.xml:

Security realms




If I don't change ApplicationRealm to my own realm, our LoginModule is not invoked!

We have beans with

and beans without that annotation.

What we want to archieve is, that we can invoke some beans without being an authenticated user. Do we have a chance to do this? Or do I have to use some dummy user for those beans? (That would mean to user two different users in my client application. The user [identified by username and password] himself and the dummy user. So I'd need two different login contexts. (??)

Any hints?
5 years ago
You should not expect to find classes in packages like javax* to be inside jars with a javax-prefix... Swing classes are inside rt.jar.
6 years ago

Campbell Ritchie wrote:Question too difficult for “beginning”. Moving to the Oracle forum.

That's not an oracle question, it's a question on how to analyze a stacktrace...
6 years ago

Rithanya Laxmi wrote:Thanks. The exception.getMessage() returns only "org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update" and not
ORA-00001. Similarly the exception.getCause() returns only "ConstraintViolationException". Hence how we can get the respective Oracle error code & message? Please clarify.

That's right, getMessage() returns what you said. That message does not contain any "ORA-"-parts. So that's 2b from my post. Call getCause() which gives you another Throwable. This one is not null, so start over with No. 1 on THAT throwable - didn't mention this explicitly because it was quite clear to me.

If the stacktrace above is correct, this getMessage() should bring "java.sql.BatchUpdateException: ORA-00001: unique constraint (RRTS.RRTS_CUST_ID_PK) violated".
Do this as long as:
- getCause() does not return null
- getMessage() contains what you're looking for
6 years ago