-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big Panache API refactor #1021
Big Panache API refactor #1021
Conversation
Summary updated |
@gsmet it passed CI :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge before the big renaming and discuss that more in depth next week.
Thanks! |
Is there examples of usages (code example_, vs this list? That would help me. |
Was it worth having? vs a foreach and passing EntityBase::persist or whatever the kool functional kids are doing? |
I can use |
Some other frameworks have it, @gsmet said it would be useful. I figured it didn't harm, but it doesn't do more than what you suggested.
Yes, pagination is on the resulting |
@emmanuelbernard #1054 has the guide. |
Big Panache API refactor.
Project
independent-projects/panache
(since it cannot function without Quarkus)extensions/panache/runtime|deployment
intoextensions/panache/panache-jpa
(subfolder for all panache modules)shamrock-panache-jpa
extensions/panache/common/runtime
(shamrock-panache-jpa-runtime
depends on it)shamrock-panache-common-runtime
(becauseshamrock-panache-rx-runtime
will use those classes)Names
Model
is now calledPanacheEntity
(that's your entity base class with an ID)Entity
Entity
because@Entity
is using it, so prefixing withPanache
EntityBase
is now calledPanacheEntityBase
(that's the entity base class if you specify your own ID)DaoBase
is now calledPanacheRepositoryBase
and is parameterised with an extra ID type parameterRepository
and notDao
findById
argument (wasObject
)PanacheRepository
is what people should extend for their repositoryLong
JpaOperations
is gone inimpl
packageQuery
is now calledPanacheQuery
Query
is super overusedPanache
with general operationsParameters
,Sort
,Page
in commonPer class changes
PanacheEntity
Long
ID instead ofInteger
PanacheEntityBase
save()
is now calledpersist
since it does not do persistOrUpdate anymorefind/count/delete
now take eitherObject...
for indexed params, orMap<String,Object
orParameters
for named paramsParameters
is a trivialMap
builder with less ceremony than the JDK providesfind/count/delete
now take an optionalSort
for specifying sort columns and orderslist/stream
that calllist/stream
onfind
(for small tables with no paging)list(query)/listAll()
,find(query)/findAll()
,stream(query)/streamAll()
anddelete(query)/deleteAll()
butcount(query)/count()
to mark expensive/dangerous operations withAll
butcount
is harmfull andcountAll
seems weirdpersist(Iterable/Stream/Object[]
to persist more than one entityPanacheRepositoryBase
has the same changesfindById(Id)
insteadoffindById(Object)
(because we can here, and we cannot forEntityBase
)PanacheQuery
count()
method which executes an HQL count for the query, which counts the number of results with no paging (it's cached)nextPage()
,previousPage()
,firstPage()
,lastPage()
,hasNextPage()
,hasPreviousPage()
,Page page()
andpageCount()
that sometimes make use of thecount()
method when requiredgetFirstResult()
tofirstResult()
getSingleResult()
tosingleResult()
Page
of(size)
toofSize(size)
Page index(newIndex)
to change the page indexParameters
Parameters.with("foo", bar).and("gee", baz).map()
Parameters.of(K, V)
,Parameters.of(K, V, K, V)
like JDK 9 but really it's not more readableEntity
I think we should addParameters parameter(key, value)
instance method that delegates to theParameters.with
just to get auto-scopeSort
static Sort.by(String column)
to sort by one column ASCstatic Sort.by(column, direction)
to sort by one columnstatic Sort.by(column...)
to sort by more than one column ASC (alias forSort.ascending(column...)
)static Sort.descending(column...)
to sort by more than one column DESCdescending()
/ascending()
/direction(Direction)
to change a sort direction (for all columns)and(column)
to add a column ASCand(column, direction)
to add a columntoOrderBy()
not entirely sure it's useful to make it public, but it does what it says