9
votes
Accepted
Micro-service database management?
Microservices do come with a performance penalty for some cases, which is offset by better scalability. It may seem like a paradox, but sometimes you need to make an individual operation slower in ...
8
votes
Examples of mid/large-scale web-apps built without an ORM?
Stack Overflow uses a micro-orm. Unlike Hibernate, it's just a thin veneer around SQL queries.
Answers to your questions:
By writing a SQL query.
It can vary from one line of code to about 40. ...
8
votes
How to design a complex REST API considering DB performance?
I think you have complexity because you are starting with over-complication:
Paths would be something as:
companies/1/departments/1/employees/1/courses/1
companies/1/offices/1/employees/1/...
6
votes
Micro-service database management?
The reason why you often have a database for each micro-service, is in order to separate each part of the system. If you store everything in one database, you will (as mentioned by Michal Kosmulski) ...
6
votes
Accepted
In new project where you have ability to define DB and write app code, what is seen as best practice?
In the long run, going database model first will very often pay off compared to what appears to be a quick win of going client model first. Before I explain, let me just disclaim that your domain ...
6
votes
Best way to deal with Hibernate 1->Many relationship over REST/JSON service
Since you're using jackson you should take a look at this : https://github.com/FasterXML/jackson-datatype-hibernate
With this module, jackson will not serialize LAZY fields if you didn't initialize ...
5
votes
How to design a complex REST API considering DB performance?
IMHO, I think you're missing the point.
First, the REST API and DB performance are unrelated.
The REST API is just an interface, it does not define at all how you do stuff under the hood. You can ...
4
votes
ORM: runtime proxies vs bytecode instrumentation
Both Hibernate and EclipseLink use the Proxy design pattern to implement lazy/eager loading of entity relationships. Proxies are weaved into Java bytecode at build time (statically) or at runtime (...
4
votes
Examples of mid/large-scale web-apps built without an ORM?
You should check out Elixir's Ecto, which is a domain specific language (DSL) for interacting with (mostly relational) databases and writing queries. It goes well with the Phoenix framework, which ...
4
votes
Examples of mid/large-scale web-apps built without an ORM?
There are various design patterns that are useful for applications that are not using ORM. I'd suggest reading through Martin Fowler's book, Patterns of Enterprise Application Architecture, which ...
3
votes
Accepted
How to represent and validate website URLs for a JPA entity
From@URL Java Doc:
Validates the annotated string is an URL.
The parameters protocol, host and port are matched against the
corresponding parts of the URL. and an additional regular expression
can be ...
3
votes
How, in Three Tier Architecture is Database Access Achieved
In an app like this the "tiers" are usually various parts of the same application. You could write it as multiple JARs packaged into a single deployment, but the different tiers are more about ...
3
votes
How to design a complex REST API considering DB performance?
Question 1: Is my thinking correct, is "where to cut the hierarchy" a typical engineering decission I need to make?
Maybe - I'd be worried that you are going about it backwards, though.
So ...
3
votes
What do you think about DTOs in Spring Data JPA project?
Both your approaches raise some concerns. The main concern about the first approach is that you'll end up with a lot of duplicate methods. This isn't exactly a problem though, because both methods ...
3
votes
Accepted
Decouple business logic from DTO
I'd consider a top-down approach. What kind of code would you like to see in the top level method of the service? I'd prefer seeing a short list of steps needed to fulfill the service request.
It ...
3
votes
How to correctly translate UML Association, Aggregation and Composition to a Hibernate mapping?
Aggregations and compositions are specialized associations that carry some additional semantic (i.e. meaning):
UML doesn't specify the semantic of aggregation ("Precise semantics of shared ...
3
votes
Optimizing writes over the same entity in relational DB
Although the frequency of updates per minute may not seem excessive, and your database should have no difficulty handling it, it may be worth considering implementing an in-memory buffer to keep track ...
2
votes
How to design a complex REST API considering DB performance?
In general, you don't want any implementation details exposed in the API. msw and VoiceofUnreason's answers are both communicating that, so it's important to pick up on.
Keep in mind the principle ...
2
votes
Accepted
How to optimize a bloated entity that causes a huge query
Common solutions to this class of problems:
Use HQL. In DAO methods that are for specific purposes, it is easy to use a custom HQL with (left) join fetch to specify exactly what data you want to pre-...
2
votes
Accepted
How to paginate local and remote data?
This is a difficult problem. Maybe we can simplify it?
Problem with standard paging is that you typically need to know how many are there results in total - so that you can display links to page 1, ...
2
votes
Accepted
Does separating Domain model and Persistence model have impact on transactional aspect?
The linked blog post is rather vague and seems be a confusion of active record and entity object pattens rather than using data transfer objects.
Bear in mind that underneath whatever orm or wrappers ...
2
votes
Accepted
How to reuse boilerplate code for Hibernate session management?
Make use of inheritance.
This code already follows the Template Method pattern, with doWork() being the method called by the template. Turn this code into an abstract superclass and subclass all of ...
2
votes
Accepted
Best way to track user changes
I'd go with the second one if you're doing it that way; the ideas "user" and "user role change history" are two different things. It'll make it easier to differentiate between the actions "check what ...
2
votes
Query with a lot of fields and joins
Even when creating a fresh application and deciding to use an ORM, it can be very tricky, especially if you're not familiar with how the ORM works. An ORM can make it seem easier to deal with the ...
2
votes
Accepted
Can I reduce locking for this scenario using Hibernate and H2
I assume that H2 will get a SHARE lock when querying the database, and needs a WRITE lock to add new rows the table, which it cannot do whilst there is a SHARE lock on a table.
That is only true if ...
2
votes
Best practices for retrieving data scattered over multiple tables
Data Transfer Objects are used (among other things) so you don't send your entities over the network, and therefore create a dependency between the entity and the output of your API, this is why you ...
2
votes
Accepted
What to do when putting logic into the database seems to be the only option?
So essentially you've run into performance issues, and decided to go lower down in abstraction levels. This is a sensible approach although sometimes it's not the most long term approach; but it ...
2
votes
Optimizing writes over the same entity in relational DB
Roll a new GUID for each voting event,
and append a one-line entry to a text file of votes,
perhaps in CSV format.
Either fsync() the write immediately,
or have a background thread issue
fsync's every ...
1
vote
Query with a lot of fields and joins
The ORMs are a helpful tool to abstract a lot o things related to the update, insert, select and delete informations from a database.
I think they are popular because most of the applications does ...
1
vote
concept for de- and encrypting personal data in web portal
Having a database store encrypted contents and end-to-end encryption are quite frequently NOT feasible approaches. The problem is who has access to the plaintext contents. E.g. for a web app:
The ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hibernate × 85java × 48
jpa × 20
spring × 19
orm × 14
database × 12
architecture × 6
rest × 6
database-design × 5
entity × 5
spring-boot × 5
domain-model × 4
design-patterns × 3
web-development × 3
domain-driven-design × 3
performance × 3
sql × 3
web-services × 3
mysql × 3
relational-database × 3
maven × 3
dto × 3
spring-mvc × 3
design × 2
java-ee × 2