ActiveJDBC is a Java ORM modeled on ActiveRecord from Ruby on Rails.
Questions tagged [activejdbc]
215 questions
0
votes
0 answers
active-jdbc: Include multiple database tables
I am building one web application using activeweb. I am trying to export a table named orders which is related to other child table dispatch where the product detail for that orders is stored.
When I am trying to join the table using the…

sreejith nair
- 11
- 1
0
votes
1 answer
ActiveJDBC MAX() function
I'm new to ActiveJDBC and Java.
How can I do
SELECT MAX(age) FROM persons
with ActiveJDBC on a MySQL database?
I have tried
Pesrsons.find("MAX(age)")
but this one returns an empty list
and
Persons.FindBySql("SELECT MAX(age) FROM persons")
this…

pomalo
- 13
- 2
0
votes
1 answer
ActiveJDBC and Cobertura instrumentation
We want to use ActiveJDBC for database access. So far, everything works as expected after some minor hurdles with ActiveJDBC instrumentation in our IDEs.
However, we use Maven to build our projects and use Cobertura for reporting about code…

Jakob Steltner
- 3
- 2
0
votes
1 answer
activejdbc - store fetched database metadata
Is it possible to store somehow fetched metadata from database?
I need to run this process many times and it works too long. It would be
great to have possibility to load these metadata from any local object
and refresh it when it is needed.

Panczur
- 11
0
votes
1 answer
How to retrieve the default values after inserting with ActiveJDBC
Let's say I have a column to store the creation time of the record, like a timestamp with DEFAULT CURRENT_TIMESTAMP. After inserting, the Model doesn't contain the value set by the database (the value is null).
Is the only way to get such info to…

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
How to clear EHCache?
I'm in the process of upgrading JavaLite ActiveJDBC from EHCache 2.x to v 3.x.
It looks APIs changed dramatically, and I can find equivalents of what I need in v 3.x, except for one: How to clear all caches? For example, in v2.x, I could do this:…

ipolevoy
- 5,432
- 2
- 31
- 46
0
votes
1 answer
Detect models deletion
I have a working SQLite database with ActiveJDBC. I would like to perform some operation when I detect that a model is being deleted (either through direct deletion, or as a result of a cascade delete). I can detect direct deletions by overriding…

Alberto Anguita
- 103
- 1
- 11
0
votes
1 answer
ActiveJDBC @BelongsTo JOIN? Cached?
Let's say I have a model M1.java that contains
@BelongsTo(foreignKeyName = "m2_id", parent = M2.class)
and then after loading M1 I do
M2 myM2 = myM1.parent(M2.class)
I suppose an extra query is made to fetch the M2 object (similar to Hibernate…

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
ActiveJDBC doesn't instrument Model when it contains forEach/lambda
After wasting a lot of time investigating why one of my Model classes was not instrumented anymore, I realized this line of code, from a static method I added to my Model, was the culprit:
// myObjects is a…

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
Truncate table with ActiveJDBC
What is the best way to truncate a table with ActiveJDBC? The Model class only has deleteAll().
So I guess I need to run a native SQL query, is Base.exec("TRUNCATE TABLE table1") the way to go?
Thanks.

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
ActiveJDBC batch insert and transaction
What is the recommended way to insert a batch of records or none if the database raises an error for any of the inserts?
Here is my current code:
PreparedStatement ps = Base.startBatch("INSERT INTO table(col1) VALUES(?)");
for (MyModel m :…

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
Working with generics and ActiveJDBC Models
I am trying to convert a list of records to some Java object (so, ActiveJDBC Model to another Java class), but I want to be able to call the same method for all my models and pass the Model type, something like:
private List…

Maxime Laval
- 4,068
- 8
- 40
- 60
0
votes
1 answer
Doing additional operations during ActiveJDBC Model construction
I have a database with one table words, so my Model in ActiveJDBC is Word.
When a row from the database is casted to the Word model, I want to perform some additional operations, such as casting some data to enums for better abstraction.
I added a…

Chris Cirefice
- 5,475
- 7
- 45
- 75
0
votes
1 answer
Deleting an Entry in the join table of a Many-to-Many Relationship
Using the example in the documentation: I have Doctors and Patients who are connected over a join table.
Now I delete a Patient from a Doctor, which works fine, i.e. the row in the join table vanishes:
doctor.remove(patient);
Is there a way that I…

valley
- 157
- 1
- 13
0
votes
1 answer
How to get distinct rowcount using ActiveJdbc?
How do we get distinct rowcount in activejdbc? I tried many different variations but none of them worked
Tablename.count("?", "distinct id")
Tablename.count("distinct ?", "id") //missing expression
Base.exec("select count(distinct id) from…

Bala
- 11,068
- 19
- 67
- 120