Crowd database IDs

I just installed the Crowd Server and I am looking at the database, which only has one user and one directory. I am wondering how the IDs are created, as there are no sequences in the database.

Hi @robertegan305,

Crowd relies on Hibernate’s style sequence generators. Is there anything in particular about those sequences you are interested with?
If you are looking on adding additional rows to database I would suggest using Crowd’s Java API

Hope that helps!
Marcin Kempa

Interesting. Because my newly installed Crowd database has 6 digit sequences. I would guess that if they use Hibernate, they are not starting with 1. Because I doubt crowd created several hundred thousand entities when I installed it.

Hi,

It is not starting with 1 it is using other algorithm to ensure performance, and no it is not creating that many records on startup it is where it starts with the counter.

Marcin Kempa

1 Like

Time to revisit this.

I need to add approximately 2500 rows into cwd_user_attribute, using data from another crowd database.

I really don’t want to add them through the UI. How can I get an ID for my insert statements?

What are the odds that I can use the ID from the existing database?

So here’s the deal. I created SQL INSERT statements with an ID of MAX(ID) + 1, and the SQL executed without errors. But it broke the ability to add new users, presumably because my IDs conflicted with it’s generated IDs, which seems reasonable.

But after thinking it through, and operating on the assumption that builtin counter only increments, I switched my SQL statements to MIN(ID) - 1 and so far it seems to be quite happy with that.