I was wondering is it possible to create from jpa/hibernate annotation a database column description/comment like this: ALTER TABLE tablename CHANGE status status INT(11) NOT NULL COMMENT ‘sample description/comment’; It will be great functionality, but I cant find anything about this in JPA specification. Maybe I should use @Column(columnDefinition=””) property, but I dont have any clue. Please help Answer I
Tag: java
Class.forName(JDBC_DRIVER) no longer needed?
I’ve read here on SO that since java 6 you no longer need to register JDBC Driver using: Class.forName(JDBC_DRIVER); because DriverManager uses the path located in system property “jdbc.drivers” …
Trying to get value out of a select option in the same form
I’m trying to get value out of the select option. But it doesn’t seems to be able to get since it’s on form. How do I do it ? I mean by having taking the value out of the option select. Answer 1.) You can not select all the items in a select with selected ! Without multiple=”multiple” E.g. topFr[]
jOOQ: Mocking DAO objects
jOOQ 3.5.0 I’m currently trying to write unit tests for a resource that is using jOOQs generated DAO objects. I’ve noticed one of the base classes (DAOImpl) in the DAO hierarchy has many final methods which makes it unfriendly to mock (I’m excluding byte code manipulators like Powermock as a solution). I’m currently using the MockConnection and MockDataProvider pattern to
How to enable logging for SQL statements when using JDBC
I am trying to enable logs using my JDBC program by connecting to Oracle database in eclipse IDE. I have gone through this SO post JDBC logging to file then I have created below java program and running it from my eclipse IDE, but I was not able to see any logs generated by the JDBC driver classes. and I
Can’t insert Cyrillic symbols into MySQL with JDBC
I have a web app which uses com.mysql.jdbc.Driver to connect to MySQL database. Here are jdbcMySQL.properties: I create database like this: And the problem is: if I make then I have in my table BUT, if I make: I have in my table: Answer MySQL is a bit crazy w.r.t. encodings, try: Furthermore there is one more possible error cause:
Java – Can’t use ResultSet after connection close
I have a problem with closing a connection to MySQL. I’m getting the error: java.sql.SQLException: Operation not allowed after ResultSet closed My code: public static ResultSet sqlquery (String …
Stackoverflow with Hibernate using sql IN (id, id, id, id..id)
I am getting the error below saying there was a stack overflow. This is happening because a SQL statement with IN (id, id, id…id) has a ton of parameters. Is there anyway to fix this? This is happening in my local environment with Eclipse. JPA Error Hibernate Query Answer In our Grails project (2.3.6) with Hibernate 4.3.1.Final, we never had
Passing a non-column parameter in a MyBatis ResultMap to a nested select
I’ve a One-to-Many relationship in my domain model where I basically want to read Foos and a filtered set of Bars with one MyBatis select statement using a nested select for the Bars. To explain: My domain model classes look more or less like this (the real domain model is more complex of course, but my problem boils down to
Convert oracle.sql.timestamptz to postgresql timestamp with timezone
Sorry, but i`m noob and i need your advices. I have some result set from oracle with timestamptz, i get string value of this timestamptz which like 2014-1-10 13.47.56.0 7:0 and then I need put it in postgresql-request in some function which takes timestamp with timezone. How can I convert this this string to timestamp with timezone in java? I