There are no sequences in mysql,
you can use id generation (when you insert the record, it generates an id, dont use it for complex relationships), or table generator which is quite cool (
details).
so I created a simple version of your stuff
Answer:
xml for it:
Question
xml:
sql script:
It works for me, with hibernate as well.
Note:
many-to-one and one-to-many are the last elements of the mappings. with hibernate it seems to be required..
You dont need to use basic if you use default values (other attribute = other column). Try to use default values, it can reduce the code, and improves the readability.
you can use annotation or xml, or both. you can specify the same mapping with xml and annotations (in theory

).
however annotations could be easier to understand how jpa works.