Hi guys, Im having some troubles trying to configure a many to many relationship between a class i have just created (Installsupport) and another one called userInfo which as implementation of springframework.security.core.userdetails..
the idea is creating and inbetween table named /Users_InstallSupport) where Installsupport and UserInfo where a given object installSupport is able to get all the Usernames of the users related to it (IinstallSupport will be the owner of the table)
this is InstallSUpport.hbm.xml set property:
<set name="users" table="User_InstallSupport" lazy="false" cascade="all-delete-orphan" inverse="true"> <key column="installSupport_id" not-null="true"/> <many-to-many class="com.albentia.products.security.data.UserInfo"> <column name="username" not-null="true" /> </many-to-many> </set>
and here i have sql code for the created tables: ************************ Installsupport class TABLE ************************************
CREATE TABLE `InstallSupport` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `problemDescription` text, `setupDate` datetime NOT NULL, `solDescription` text, `customSetup_id` bigint(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT=' represents a home setup intervenction';
******** users table*************
CREATE TABLE `users` ( `username` varchar(50) CHARACTER SET latin1 NOT NULL, `password` varchar(50) CHARACTER SET latin1 NOT NULL, `enabled` tinyint(1) NOT NULL, `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`username`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin2 COMMENT='Spring security DB schema'; /*!40101 SET character_set_client = @saved_cs_client */;
****************** In between table ********************
DROP TABLE IF EXISTS `User_InstallSupport`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `User_InstallSupport` ( `installSupport_id` bigint(20) NOT NULL, `username` varchar(50) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`installSupport_id`,`username`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin2;
the problem is in fact,that i got users setted on the Installsuportclass...but any persistence is reached on the DB.. I think that may be there is any issue trying to use the key username as long as its an String.... or may be there is a kind of issue or incompatibility between SpringUserdetails and hibernate...
Any Idea?????
|