Ebean PGvector

29 views
Skip to first unread message

Ryszard Trojnacki

unread,
Oct 8, 2025, 10:47:23 AMOct 8
to Ebean ORM
Hi Rob,

I have done some work to make Ebean work with pgvector extension for Postgres.

So far I have:
1. Extended ebean-datasource module to add posibility to register PGvector types.
2. Added module for main ebean.

Ad. 1. This just adds a new listener that allows to do something with newly created connection for example do: PGvector.registerTypes(connection);

Overall I'm not sure if this is the right way to do this.
This allows for manually changing new connection settings. But for a module this makes no sens. The module should be initalized without extra manually written code like: io.ebean.core.type.ExtraTypeFactory that is in META-INF/services.

Should I change this to ServiceLoader mode?


Ad. 2. I have added a module ebean-pgvector that adds scalar types, but to do that I had also to:
- add extra types: ExtraDbTypes,
- add types to enum DbType,
- register new types in PostgresPlatform.

And now when everything is done I'm trying to run tests, but I have problem with this.
I have added PGvectorSetup and registered it in PlatformAutoConfig. I have setup this in application-test.yml, but it (Docker container) doesn't start.

What I'm missing?


-- 
Greetings,
Ryszard Trojnacki

Rob Bygrave

unread,
Oct 31, 2025, 9:32:59 PM (6 days ago) Oct 31
to eb...@googlegroups.com
Sorry for the late reply, I've got a couple more things to sort out ... so I should get to this in 2 days time.

Cheers, Rob.

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ebean/6d380161-a498-46a7-b897-1e26f394fb54n%40googlegroups.com.

Ryszard Trojnacki

unread,
Nov 1, 2025, 4:04:16 AM (5 days ago) Nov 1
to Ebean ORM
> so I should get to this in 2 days time.

Happy to hear that.

Rob Bygrave

unread,
Nov 4, 2025, 3:38:00 AM (2 days ago) Nov 4
to eb...@googlegroups.com
> 1. Extended ebean-datasource module to add posibility to register PGvector types.

Yes, create a PR. I think we might tweak it a little bit but yes submit the PR.


> Overall I'm not sure if this is the right way to do this. ... Should I change this to ServiceLoader mode?

Regardless of if it supports a ServiceLoader or not we need the API, so I think submit the PR.

Q: Would we then allow the use of ServiceLoader to auto register a "DataSourcePoolNewConnectionListener" ?
A: Yes, I think we can do that. It would make sense to support that I believe.


> I have added PGvectorSetup and registered it in PlatformAutoConfig. I have setup this in application-test.yml, but it (Docker container) doesn't start.

I'm not sure. It looks like the `platform: pgvector` might be an issue though as that should reference a platform known to ebean-test-containers so maybe that should be postgres instead. [but maybe we extend ebean-test-containers with specific support for pgvector such that we can programmatically setup the test container - the programmatic setup is my preferred approach these days generally so it would be good to support that].


So yes, submit a PR for ebean-datasource and lets go from there.


Cheers, Rob.


Ryszard Trojnacki

unread,
Nov 4, 2025, 3:14:47 PM (2 days ago) Nov 4
to Ebean ORM
I have created a PR: https://github.com/ebean-orm/ebean-datasource/pull/139

I will now go with the second approach with `ServiceLoader` (expect a PR in next few days with this).

Rob Bygrave

unread,
Nov 5, 2025, 3:30:27 AM (yesterday) Nov 5
to eb...@googlegroups.com
> I will now go with the second approach with `ServiceLoader` (expect a PR in next few days with this).


Ryszard Trojnacki

unread,
Nov 5, 2025, 4:03:23 AM (yesterday) Nov 5
to Ebean ORM
Great!

I will go now with `ebean-pgvector-types`.

To create this module I needed to add new types to `ebean-api`:
This seems easy, but I not sure, if the constant values is ExtraDbTypes are correct?

And the rest is done like with `ebean-net-postgis-types`.

I have tried once again to go with the tests and I see, that I need probably to update first ebean-test-containers for pgvector to make this work. Am I right?
(I will go with this after work)


Rob Bygrave

unread,
Nov 5, 2025, 4:35:31 AM (yesterday) Nov 5
to eb...@googlegroups.com
> This seems easy, but I not sure, if the constant values is ExtraDbTypes are correct?

Yes this is correct thing to do. Those constant values just can't clash with the ones in java.sql.Types (and no they don't so it's all good there).


> that I need probably to update first ebean-test-containers for pgvector to make this work. Am I right?

Yes, I think so. It will likely look similar to the PostgisContainer extends BasePostgresContainer.


Cheers, Rob.

Ryszard Trojnacki

unread,
Nov 5, 2025, 12:10:09 PM (yesterday) Nov 5
to Ebean ORM
I have added new PR: https://github.com/ebean-orm/ebean-test-containers/pull/133 - `PGvectorContainer`.
With this new `ebean-test-containers` my tests are starting now.

This test container tests (`PGvectorContainerTest`) could be updated in future with Ebean PGvector tests, but for now this is imposible without registration of those types.

I think in a day or two I will finish the `ebean-pgvector-types` module.

Rob Bygrave

unread,
Nov 5, 2025, 3:39:16 PM (23 hours ago) Nov 5
to eb...@googlegroups.com
Awesome, merged and released as version 7.17

Reply all
Reply to author
Forward
0 new messages