Hi guys
another question. I can see that roo supports one to many relationships in hibernate.
how about one to one?
also is there a way to create the sql scripts from the entity objects?
Thank you
Hi guys
another question. I can see that roo supports one to many relationships in hibernate.
how about one to one?
also is there a way to create the sql scripts from the entity objects?
Thank you
Hi,
To create a relationship you could use the 'add field reference jpa -type com.foo.Pet -fieldName myPet -class com.foo.Owner'. This will generate a field like this in Owner.java:
We are reviewing if it makes more sense to use JPA's @OneToOne relationship instead.Code:@ManyToOne @JoinColumn private Pet myPet;
I am not clear what exactly you are trying to do. But if you want to create your own query you could just use the JPA entityManager which is already existent in your JPA @Entity:also is there a way to create the sql scripts from the entity objects?
Is this what you are referring to?Code:public List<Owner> test(){ return entityManager.createQuery("select p from Owner p").getResultList(); }
-Stefan
Hey Stefan
thanks for the answer.
The second part was more about if i can create "table statements" like create table Owner (id auto_increment int primary key, name varchar(50))
from roo and its managed entities...
Thanks
btw where are you guys located? you have a very german name![]()
Hi,
For the feature of executing SQL scripts upon application deployment you can take a look at the petclinic samples in Spring framework. They create tables and pre-populate the tables upon application start if that is what you are referring to. In the upcoming Spring 3 release we will also include a new feature which let's you configure that very conveniently for embedded databases via the application context.
Ben and I are based in Sydney, Australia, but indeed I am German.
-Stefan
Nice thank you... i will take a look at those samples...