0
votes
0answers
13 views

Update values in join table using Hibernate

Given this entity class @Entity public class Profile extends Model { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; ... @OneToMany(fetch=FetchType.EAGER) ...
0
votes
1answer
28 views

Can I have multiple statements in a native query in JPA 2

I want to execute the following query to conditionally drop a temporary table. String dropSql = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE " + tmpTblName + "';" + " EXCEPTION" + " WHEN OTHERS ...
0
votes
2answers
29 views

Table rows seem to be disapearing

I have a ton of raw html files that I'm parsing and inserting to a MySQL database via a connection in Java. I'm using "REPLACE INTO" statements and this method: public void migrate(SomeThread ...
-1
votes
1answer
32 views

Why does java throw the Parameter index out of range SQLerror

I've been running this code multiple times and java keeps throwing the java.sql.SQLException Parameter index out of range (1 > number of parameters which is 0), I think it bugs on the SELECT * FROM ...
0
votes
0answers
26 views

Two Versions of JPA entities for a Single Table

Hi How do I get Two JPA entities for a Single Table. I tried to achieve One Lighter Version with out any Joins (For List Page). and One Heavier version with all mappings (For View Details Page). For ...
2
votes
3answers
30 views

How to use JPA with a random database i.e., user submitted

I am using UCanAccess and was setting up my Entities and Persistence Unit when I realized that the DB location is hard coded into the PU.xml (which is fine to build my entities, but I need to have it ...
1
vote
0answers
17 views

Creating a reference application that uses sqlite [on hold]

I want to create a reference Android application for a specific video game. The app would only contain information about the game(Enemies, Items, Item locations, etc) similar to most video game wikis, ...
0
votes
1answer
11 views

HQL: Counting a child collection conditionally within a query

I'm fairly inexperienced when it comes to HQL, so I was wondering if anyone can help me out on this. I have a relationship where Student has a OneToMany relationship with StudentCollege. I'm trying to ...
0
votes
1answer
14 views

Java - Read a List returned from MYSQL query with hibernate

My Java class do a mysql query and it's result is stored in result list. In the attached image you can see the structure data of one element of the list result. My question is: how can I parse each ...
0
votes
0answers
30 views

JDBC: query does not fetch all data [on hold]

I have a really weird problem with a simple SELECT query. This query is supposed to fetch 7888 elements from database, but it only fetch 2640 elements ! I wrote this query using a preparedStatement. ...
1
vote
1answer
25 views

Comparing dates java.util.date with Date datatype in db

I have java.util.date and there is a column date in Oracle db table of DATE datatype and value is stored in format 31-JAN-36. I want to compare java.util.date with the date column in db and return if ...
1
vote
1answer
13 views

MS ACCESS integrity constraint violation: NOT NULL check constraint;

<%@ page import="java.sql.*" %> <HTML> <BODY> <form method="post" > Name:<input type="text" name="userName"><br> Password:<input type="password" ...
1
vote
2answers
25 views

Dynamic select statement for SQLite

I'm building an API, for this API i want to have my database handler as dynamically as possible. I do have the update and insert query's dynamic by using the SQLiteDatabase class .insert and .update ...
0
votes
1answer
41 views

Java criteria API - select * from table where id = id

I am new to the criteria api and am trying to build a select query where id matches id. I would like to build this: SELECT * FROM movie WHERE id = id(input var) So far I have this with an input ...
0
votes
1answer
44 views

Create Unique Index not helping to stop duplicates

I have a primary Database table named details with three columns of interest - _id | Name | BirthDate | xx | xx | xx | ... I create a unique index on the above table with the following ...
-6
votes
0answers
30 views

Request JSON with SQL entries via Java [on hold]

I am making an android app that requests private SQL data from my server, what is the best way to request it securely with a session? Thank You. [EDIT] Sorry if it's too broad a question, i'll try ...
-1
votes
1answer
26 views

To establish sql-connection from jUnit test [on hold]

I'm using PostgreSQL 9.3. PostgreSQL driver is postgresql-8.3-603.jdbc4.jar. I need to write jUnit test which establishes sql-connection and aggregating data from a database. The following @Test ...
0
votes
2answers
21 views

Java JPA - Create table from entity not working on the second run

I've an entity class something like: import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import ...
1
vote
1answer
57 views

Problems updating a row using a JDBC ResultSet

I am trying to update a row, with information obtained from a swing GUI. This is my exception: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row.BookFrame ...
0
votes
2answers
28 views

SQL Update : WHERE clause error

I don't know whats wrong with this query : SQL = "UPDATE "+ choosenClass +" SET COUNT = "+count+" WHERE NAME = "+names; stmt2.executeUpdate( SQL ); Error : java.sql.SQLSyntaxErrorException: Column ...
0
votes
1answer
45 views

How expensive is connection.createStatement

I have to write a java program to fetch data from 3 tables. For some business reason I can not join them. I have to fetch the records one by one as follows Fetch all records from Table1 For every ...
0
votes
1answer
26 views

Java - jdbc select method for multiple columns [duplicate]

public void Execute_Select_Statement(String instruction) throws SQLException { PreparedStatement ps = null; try { ps = this.conn.prepareStatement(instruction); ResultSet ...
-4
votes
0answers
34 views

Can you tell me how to connect database and gwt Please [on hold]

Can you tell me how to connect database and gwt Please.
0
votes
2answers
25 views

Null pointer Exception while using SimpleCursorAdapter [duplicate]

Hey guys I would like to get some data from my database... I 'm using the SimpleCursorAdapter to transmit the data to a list view but I get a NullPointer Eception here is the LogCat: 10-01 ...
0
votes
1answer
28 views

Hibernate - Query multiple tables with one hibernate-mapping

I do have a hibernate mapping which looks like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" ...
0
votes
2answers
24 views

Foreign key usage in Java with Hibernate

I am trying to develop a web application and I was wondering if there is a way to utilize a foreign key without writing a lot of code. My Trainees.java @Entity public class Trainees { @Id ...
-2
votes
1answer
23 views

App crashing on “Getwritabledatabase()”

Im new to Java let alone Android app development. My application is crashing when im trying to retrieve a created Table. I'm pretty sure the code is solid and im suspecting that my queries are ...
0
votes
3answers
37 views

MySql Select Query is not acting properly

I want to search in a Date column. I use this query: SELECT * FROM requestserverdb.closedrequests WHERE ClosingTimeStamp >= '2014-09-04' AND ClosingTimeStamp <= '2014-09-19'; I only get ...
0
votes
2answers
41 views

SQL - Return row if Boolean is True

Im trying to create an SQL Statement that will differentiate between employees types. For example if the Boolean Type Manager Column is checked it will return. Im using the info to fill a Manager on ...
1
vote
1answer
28 views

json query in if condition

{ "class": "premnath", "forInitiatorOnly": true, "text": "#if($payload.isUploaded) ${payload.getModuleRef().moduleName()} completed successfully. Number of records processed ...
2
votes
1answer
44 views

Handle Multiple Filters in Java -MySql

There are three filters Class, Section and Date. Now there are seven possibilities: 1- User inputs Class 2-)User inputs Section 3-)User inputs Date 4-) User inputs Date and Class and so on... ...
0
votes
1answer
63 views

HTTP STATUS 404: The requested resource is not available

I have this error when i started login.jsp form and type a username and password The error was HTTP STATUS 404: The requested resource is not available. What am i missing? any help? LoginAction.java ...
0
votes
1answer
14 views

Catching SQLException instead of Spring DataIntegrityViolationException in unit testing

I am writing unit test to test failed update in DB by using stored procedure. I have a stored procedure which update one of the table. From test I am sending incorrect data(i.e. data that violate ...
0
votes
2answers
38 views

How to format String to conform to PreparedStatement Acceptable format for insertion

I'm currently working on a project that requires me building a class for uploading data details from a file into a prepared table in a database. So far so good, I have done well, but my challenges has ...
1
vote
1answer
22 views

Which time zone is used by java.sql.Timestamp(long)?

When building a SQL time stamp by specifying only the milliseconds in the constructor, which time zone will be used? And how to choose whether UTC or the local time zone will be written into an Oracle ...
1
vote
1answer
27 views

JPA why queries returining 2 objects doesn't work and the one returning one object works fine

I'm using EclipseLink JPA ver 2.5.1. I have 3 queries which only differ by the columns returned. The following queries are executing correctly: 1) SELECT p.id, i.id FROM PtpFSP_R7DBImpl p, ...
0
votes
3answers
65 views

Inefficient way of getting information from Database (java, sql)

I have a table in a database which contains folders/files. Each folder can contain several files and folders which can contain more folder etc. My table has 3 important attributes. id parentid ...
0
votes
3answers
33 views

Search within the search results of an MYSQL Query

I'm writing an app in java, that receives requests and save them to a file, then it can search the old requests. I started to upgrade my app to use MySQL instead of a plain Txt file. I am looking ...
1
vote
1answer
51 views

How can I change the font of my ListView items?

I have the problem that i would like to create an custom design for my list view but I don't know how to do. I use a sql database which is in my list view. haha sorry I dont't know how to say ...
0
votes
4answers
60 views

How to split sql queries using Java

I sowed these queries:Queries are on the same line. INSERT INTO data_location ( `latitude`, `updated`, `id`, `longitude`, `created`) VALUES( '213.2000000', '2014-08-25 11:07:42+00:00', '1', ...
0
votes
1answer
24 views

Is it possible to running sql file with parameter and getting result set?

Hi dear stackoverflow users, Firstly,i want to specify that my platforms are JAVA, ORACLE and TOAD. I have some SELECT queries that include parameters and i have stored them in properties file to ...
0
votes
0answers
13 views

JPA Repository method to join tables

Suppose I have 3 entities which are mapped to corresponding tables ATable { int id; string data_a; } CTable { int id; string data_c; } ...
2
votes
1answer
38 views

How to add a password to a prepared statement in java [duplicate]

Can any one help with this issue that I'm having using prepared statements. The problem comes when trying to add the password to the statement which I am taking from a JPasswordField. String Query = ...
0
votes
1answer
30 views

How to select parent object and order by child's properties

Disclaimer: our DB is legacy and not exactly ideal. I'm trying to solve a JPA mapping problem to deal with the non-ideal DB which is beyond my work's scope to fix. Please no DB-design comments... I ...
1
vote
1answer
57 views

MySQL--unknown column in field list

I don't see why the UPDATE below works fine in the console but fails in my Java code MariaDB [testdb]> DESCRIBE datasift_geo; +-------------+---------------------+------+-----+---------+-------+ | ...
0
votes
1answer
32 views

Hibernate: Join table to a join table annotation

How do you create an annotation for the following case: Table A id name Table B id name Table C id name Table AB a_id b_id Table ABC id a_id b_id c_id name How can you represent table ABC on ...
1
vote
1answer
65 views

Android Running SQL statement in background

I am having some trouble with Alarm manager in Android. What I've encountered is when I set the alarm to repeat for every single minute, it works: mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, ...
0
votes
1answer
21 views

Get nearby latitude and longitude based on current location in servlet

Actually i am getting the value of current latitude and longitude from android device . So based on the current location i have to send the nearby latitude and longitude . Please give me some ...
0
votes
1answer
38 views

Java SQLite execSQL Syntax Error [on hold]

I have the following execSQL in my android project that is throwing a syntax error and causing my app to crash. I can't figure out why. private static final String TABLE_QUESTIONS = "question"; ...
0
votes
0answers
36 views

Querying sql database with if conditions

This might be stupid question but this code is not working.. String sql= "SELECT field, question, choice1, choice2, choice3, choice4, answer " + "FROM WineQuiz ORDER BY RANDOM() LIMIT 5"; ...