Skip to content
Advertisement

Tag: sql

A way to bind Java Map to sql varchar in JDBI INSERT statement

Is there a way to bind a java Map<String, Object> to a varchar in the the JDBI @BindBean annotation. So for example I have a class Something.class and I create a @SqlBatch(“INSERT INTO Something (name, payload) VALUES(:name, :payload)”). Now in my java class the name is of type String and payload is of type Map<String, Object> and I want in

How to create a generic DAO for CRUD methods

I’m trying to create a generic DAO for the basic CRUD methods so that I can reuse the code, but I really have no clue how to start. I already have a DAO for every class, and they work perfectly. I read lots of tutorial, and downloaded projects, but I can’t adapt (or understand) it to my program. Here is

Mapping SQL NUMERIC[10,0] to java type

I need to map NUMERIC[10,0] parameter type of a sybase stored procedure to a java type. What would be this type? Also, if you can help me define a regular expression for this NUMERIC[10,0] type I’ll be greatful. Answer Use Long as Integer is to short to map all possible values. Have a look at MAX_VALUE of both types.

jooq single query with one to many relationship

I have a table experiment and a table tags. There may be many tags for one experiment. schema: Is it possible to create a query with jooq which returns the experiments and the corresponding List of tags? something like Result<Record> where Record is a experimentRecord and a list of Tags, or a map<experimentRecord, List<TagRecord>. I also have a query which

JPA @Column annotation to create comment/description

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

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

Advertisement