discriminator

Spring-Data JPA with Multi-Tenancy Hibernate

痞子三分冷 提交于 2019-11-30 10:04:13
I am trying to get Spring-Data JPA working with Hibernate with a custom MultiTenantConnectionProvider. Everything in my configuration below seems to work. My MultiTenantConnectionProviderImpl class gets called each time I try to call a Repository method. The main problem is that there is no way to provide a tenant identifier. The Repository interfaces provided by Spring-Data take care of getting the Hibernate Session. Is there any way to provide Spring-Data the tenant identifier? Or is there somewhere where we can intercept the creation of the Hibernate Session so we can appropriately call

Doctrine 2 - How to use discriminator column in where clause

拈花ヽ惹草 提交于 2019-11-30 03:12:55
I was used discriminator column in where clause like this: //f = root entity $qb = $this->createQueryBuilder('f'); $qb->add('where', 'f.format = \'image\' OR f.format = \'text\''); I've got an error: "Message: [Semantical Error] line 0, col 73 near 'format = 'image'': Error: Class Entities\File\AbstractFile has no field or association named format" How can i use discriminator column in where clause? Thanks. Koc I think that you should use INSTANCE OF It would look in query builder like this: $class = 'Entity\File\Image'; $qb = $this->createQueryBuilder('f'); $qb->where($qb->expr()-

Hibernate 4: persisting InheritanceType.JOINED discriminator column values

时间秒杀一切 提交于 2019-11-29 04:03:11
I have a simple JOINED hierarchy of documents: CREATE TABLE Documents ( id INTEGER NOT NULL, discriminator ENUM('official','individual','external') NOT NULL, file_name VARCHAR(200) NOT NULL, PRIMARY KEY (id) ); CREATE SystemDocuments ( id INTEGER NOT NULL, binary_data BLOB NOT NULL, PRIMARY KEY (id), FOREIGN KEY (id) REFERENCES Documents (id) ); CREATE ExternalDocuments ( id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY (id) REFERENCES SystemDocuments (id) ); As you can see all the sub tables do is share the same ID from the Documents table. Other than that SystemDocuments adds a binary_data