Skip to content
Advertisement

Tag: sql

MyBatis Batch Insert/Update For Oracle

I’ve recently started learning to use myBatis.I am now facing such a scenario, I need to constantly fetch a new list of Objects through WebService, then for this list, I need to insert/update each object into the oracle DB table through myBatis. The tricky part is, I cannot simply do a batch insert every time, because some of the objects

JOOQ pojos with one-to-many and many-to-many relations

I am struggling to understand how to handle pojos with one-to-many and many-to-many relationships with JOOQ. I store locations that are created by players (one-to-many relation). A location can hold multiple additional players who may visit it (many-to-many). The database layout comes down to the following: Within my java application, all these informations are stored within one pojo. Note that

Query creation in Spring Data – dynamic where clause

Is there a way in Spring data to dynamically form the where clause? What I want to do is have a method (which is like the findBy / get method) which runs a WHERE and AND using the mentioned properties which are NOT NULL. For example, Our method looks something like this Thanks. Answer Take a look at JPA Specification

Reading data from mysql database using java

Firstly, I’m reading the product name and number of products from user using jTextFields. For that product I read the product id and price from database using sql query. But in the below code I display the product price in a jtextField but while running tha file I get query executed successfully but I’m not getting anything in the jtextField.

what is the use of annotations @Id and @GeneratedValue(strategy = GenerationType.IDENTITY)? Why the generationtype is identity?

Why we are using this annotations? i need to know if this autoincrement my table id values. (GenerationType.IDENTITY) is there any other types whats actually happening when we use this annotation *Is it necessary to extend Domain abstract class?What is the use? Answer First of all, using annotations as our configure method is just a convenient method instead of coping

Invalid operation for read only resultset: updateString

Following is my code(Re-constructed) which select & update STATUS field depending upon the conditions. (Using Servlets, Oracle as Backend and JDBC driver) I am getting the error while updating: Any suggestions will be appreciated. Update 1: The same code was working when select statement was selecting data from single table, so is there any issue when selecting data from two

Getting id after insert within a transaction (Oracle)

Let’s say I have three tables: team, player, team_player. Table team_player is a bridge table allowing a “many to many” relationship. When someone wants to create a new team, they specify the initial players on that team. How do I insert both the team and team_player rows in the same transaction? That is, I’d like to insert all the team_player

How to use named parameter in plain sql with jooq

I’m using JOOQ with plain/raw SQL, so that means i’m not using any code generation or the fluid DSL thingy. The following code works: Now let’s say i have a query with multiple parameters like this: How do i use a named parameter with these types of queries? I’m thinking something like : But the above code doesn’t work (for

Advertisement