Questions tagged [speedment]

Speedment is a Stream ORM Java Toolkit

Open-source Speedment is a Stream ORM Java Toolkit and Runtime. The toolkit analyzes the metadata of an existing legacy SQL database and creates a Java representation of the data model which together with the Speedment runtime allows the user to create scalable and efficient Java applications using standard Java 8 streams without any specific query language or any new API.

Search for an old hare (of age greater than 5):

java // Searches are optimized in the background! Optional<Hare> oldHare = hares.stream() .filter(Hare.AGE.greaterThan(5)) .findAny();

Results in the following SQL query:

sql SELECT id, name, color, age FROM hare WHERE (age > 5) LIMIT 1;

No need for manually writing SQL-queies any more. Remain in a pure Java world!

Check out the documentation on GitHub

19 questions
7
votes
1 answer

Confgure Speedment without UI?

I just found out about Speedment, a Java 8 Stream-based OR/M library, and have to say that I love the idea of it. No more crazy configurations or spending time sifting through 900 pages of Hibernation docs to find the right way to annotate my…
smeeb
  • 27,777
  • 57
  • 250
  • 447
3
votes
1 answer

Bad return type in lambda expression: BigDecimal cannot be converted to long

I was trying to write a query in java stream, through speedment. When I try to sum (l_extendedprice * (1 - l_discount)) in select, I get this error: Bad return type in lambda expression: BigDecimal cannot be converted to long. Operator '-' cannot…
joaoprog
  • 45
  • 7
2
votes
1 answer

Issue with model classes after database updates,

I have created one application which can able to perform a DML operation on database. Now there is one condition the user created new table in that database(by using front-end) but that table is not accessible due to model class is not available, so…
2
votes
3 answers

Does Speedment support transactions?

I have implemented the persistence layer using Speedment and I would like to test the code using spring boot unit tests. I have annotated my unit tests with the following…
Dominik
  • 1,058
  • 8
  • 20
2
votes
1 answer

COALESCE SQL with Speedment

Code example with Hibernate which evaluate possible parameters: String query = "SELECT * FROM instances"; String where = ""; if(userName!=null) { where+="AND username = '" + userName + "'"; } if(componentName!=null) { where+="AND…
Manuel
  • 205
  • 1
  • 4
  • 17
2
votes
1 answer

How can I use OR in filters with Speedment

How can I use OR when I want to filter Speedment streams? How do I write a stream with users that are either from NY, NJ or PA? users.stream() .filter(User.STATE.equals("NY")) .collect(Collectors.toList()) This produces a list of users from…
1
vote
0 answers

How to convert a lambda expression to a sql string

I am using the speedment to access the data from the database. That way: Join > join = joinComponent      .from (Customer.IDENTIFIER)      .innerJoinOn (Orders.O_CUSTKEY) .equal (Customer.C_CUSTKEY)       .build (Tuples ::…
programmer
  • 65
  • 1
  • 7
1
vote
1 answer

manually handling of transactions with Speedment

Is it possible to manually handling transactions with Speedment? I would like to do many inserts or updates in single transaction. Default behavior of example code: for (int i = 0; i < 10000; i++) { Entry e = new EntryImpl() …
Mariush K.
  • 11
  • 2
1
vote
1 answer

What is the correct way in Speedment to access a database schema that's different from the default one?

In my project I'm using Speedment for ORM. Of course I want my code properly tested. So I decided to create an identical copy of my default database schema which I wanted to use for unit testing. In this case the name of the original schema is…
1
vote
1 answer

How do I sort a Stream in reversed order with Speedment

I have a database table that I want to filter and then sort in reversed (descending) order. How do I express that in a Speedment stream similar to this: films.stream() .filter(Film.LENGTH.greaterThan(120)) .sorted(... some expression ...) …
1
vote
1 answer

Set a custom directory where Speedment generates code

Is there any way to explicitly set which directory/package where Speedment will put generated code? By default it creates a path like "com.company.project.db0.myschema.mytable" but maybe I want something like "com.company.database".
Emil Forslund
  • 549
  • 4
  • 12
1
vote
1 answer

How can I see the SQL code Speedment sends to the database?

When I create and use a stream with Speedment, how can I see what is sent to the database? For example, if I try the first example on GitHub: Optional longFilm = films.stream() .filter(Film.LENGTH.greaterThan(120)) .findAny();
0
votes
1 answer

How to sort a Map by value with java stream?

I wanted to sort my map by value, but I do not know how to do it. I have this code to put the values in the map: Map, Double> grouped = joinFirst.stream().limit(60) …
joaoprog
  • 45
  • 7
0
votes
1 answer

Aggregation function on result table consisting of data from multiple tables using Speedment

I have completely no idea how to translate this sql query into Java Streams using the Speedment Framework. The “result table” in Java could be of any type (it could be Map or even a specially defined user class). Here’s the sql query I’m trying to…
arealek
  • 1
  • 2
0
votes
1 answer

Speedment deletes generated code when a new database is configured

My app connects with diferent databases. First of all, I generate the orm code with speedment for the first database. But when I try to connect to a newone Speedment deletes the code generated for the previous one.
Manuel
  • 205
  • 1
  • 4
  • 17
1
2