Questions tagged [activejdbc]

ActiveJDBC is a Java ORM modeled on ActiveRecord from Ruby on Rails.

215 questions
0
votes
1 answer

How do I instrument tables for a subproject(activejdbc)? IE, one of my maven dependencies uses activejdbc

I'm 80% sure the problem I'm having is because of instrumentation. So I have a project(A), that uses project(B) as its maven dependency. Project B uses activejdbc. Running mvn process-classes on project A does not appear to instrument the tables…
dessalines
  • 6,352
  • 5
  • 42
  • 59
0
votes
1 answer

How to return the first row using ActiveJDBC?

ActiveRecord has methods such as Entity.first, Entity.last, Entity.first.next etc (note there are no parameters passed). Is there a similar construct in activejdbc?
Bala
  • 11,068
  • 19
  • 67
  • 120
0
votes
1 answer

Is it possible to use Long FK in activejdbc?

I found the following code in org.javalite.activejdbc.Model.parent method: List results = new DB(getMetaModelLocal().getDbName()).findAll(query, Integer.parseInt(fkValue)); Does it mean that we can't use Long FK in Active JDBC? We will have…
0
votes
1 answer

ActiveJDBC ignores the time in a DATETIME column

Using ActiveJDBC with MySQL, the column declaration: `start` datetime NOT NULL Java Model: public class MyTable extends Model { private static final String COL_START = "start"; ... public Date getStart() { …
Maxime Laval
  • 4,068
  • 8
  • 40
  • 60
0
votes
1 answer

Unit testing activejdbc code without live database

Any suggestion on how to test activejdbc code without live database? I am unable to follow TDD because at every place it needs a live sql database and I can't mock it. Is having a live sql database for unit testing correct?
dejavu
  • 3,236
  • 7
  • 35
  • 60
0
votes
1 answer

Limiting Columns Selected with ActiveJDBC

How can I limit the number of columns being fetched by ActiveJDBC? Is there something similar to Hibernate Projections in ActiveJDBC?
Partha
  • 15
  • 4
0
votes
1 answer

How to delete record in activejdbc with no primary key?

My table does not have a primary key. So when I try to delete a record Table t = Table.findFirst("col = ?", var); t.delete(); I get below exception. Any directions? org.javalite.activejdbc.DBException: java.sql.SQLSyntaxErrorException: ... "ID":…
Bala
  • 11,068
  • 19
  • 67
  • 120
0
votes
1 answer

ActiveJDBC Many2Many with child table in different schema from parent and join tables

Say I have the one db schema named "action" that has the tables "actions" and "actionnotifications". Then I have another db schema named "notification" that has the table "notifications". I am using ActiveJDBC to query the complex action object. The…
0
votes
1 answer

ActiveJDBC complex queries

How can I make a complex query with ActiveJDBC? I have a model Student and a model Class Student: id first_name last_name Class: id name student_id I'm given two student ids 1 and 50 for example I want to get all the classes…
user1781626
0
votes
1 answer

ActiveJDBC selecting from multiple tables

I want to select from multiple tables and convert the result to json using ActiveJDBC http://javalite.io/record_selection I can do the following but it will of course return only the columns in the model book, I don't see the columns from the…
user1781626
0
votes
1 answer

Where can I find JSpec maven info

Having used RSpec in the past, I would like to use JSpec in my Java project. But I am unable to find install information in Maven Central repository or in JSpec. Would appreciate little direction.
Bala
  • 11,068
  • 19
  • 67
  • 120
0
votes
1 answer

Loading large dataset using ActiveJDBC

I have a SQL script with Insert statements (around 100 rows and might increase in the future) that I would like to execute using ActiveJDBC. Is there a way to do it?
Bala
  • 11,068
  • 19
  • 67
  • 120
0
votes
1 answer

How to retrieve the auto generated primary key in postgres with ActiveJDBC

in ActiveJDBC If I have a serial primary key in the table with column name id Employee e = new Employee(); e.set("name", "John"); e.set("age", 43); e.saveIt(); how is possible to retrieve it after saving the record? I want…
user1781626
0
votes
1 answer

How does one lock a user record in ActiveJDBC? Or is it autolocked when you use Activejdbc transactions?

How do you lock a record in ActiveJDBC? I've seen the documentation about optimistic locking, but I would like to use pessimistic locking instead. Is there a way to do this, or does locking happen automatically when you use ActiveJDBC…
Hongyi Li
  • 1,059
  • 2
  • 11
  • 19
0
votes
2 answers

How to model a customer - merchant transactions model conceptually, like in ActiveRecord for instance?

I have a customer model, a merchant model and a transactions model. Customers can make transactions to merchants and merchants can make transactions to customers as well. Eventually, I'd like to query things like: All transactions made by a…
Hongyi Li
  • 1,059
  • 2
  • 11
  • 19