Skip to content
Advertisement

Tag: java

Update cell in jTable using SQL

I want to know how I can update specific cells in jTable (in Java) using SQL. This my try but it doesn’t work. Note: I am working in Netbeans. Answer finally I’ve found the correct answer the following code will explain every thing thanks for every one helped me

How to use money data type in Java, SQL, ORM

What are best practises in using money data type in Java application? Money should be in double variable? What about rounding, currencies and so on. Are special libraries for this? And what about ORM and SQL in most popular databases. As I know not in all SQL engines is Money data type. In that case NUMERIC(15,2), DECIMAL(15,2) or REAL data

Expression language to SQL where clause transformations?

We have one domain object, I’m looking for a simple expression language that we can write that will generate SQL. (particulary the where clause of SQL) For example. translates to Does anything like this exist, or do I have to write my own? Please let me know if you think I might as well be searching for the fountain of

Substring in select statement in JPQL

I’m trying to select a substring of column, i.e. select substring(description, 1, 200) from category where id=1 Is it possible to have a substring function within a select statement in JPQL/JPA 2? If yes, how? If no, are there any alternatives? Thanks. Answer There is a scalar expression for this: SUBSTRING(string, start, end) I believe this is allowed in the

Running a .sql script using MySQL with JDBC

I am starting to use MySQL with JDBC. I have 3-4 tables to create and this doesn’t look good. Is there a way to run a .sql script from MySQL JDBC? Answer Ok. You can use this class here (posted on pastebin because of file length) in your project. But remember to keep the apache license info. JDBC ScriptRunner It’s

How to convert java.util.Date to java.sql.Date?

I am trying to use a java.util.Date as input and then creating a query with it – so I need a java.sql.Date. I was surprised to find that it couldn’t do the conversion implicitly or explicitly – but I don’t even know how I would do this, as the Java API is still fairly new to me. Answer tl;dr How

Advertisement