This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Generated Value Strategy  RSS feed

 
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I am learning JPA from book Pro JPA 2- and I have a doubt in the topic - ID Generation using the Table
My doubt is regarding @TableGenerator
When I used


it behaved like AUTO strategy.(Did it happen because I missed the strategy? But no such mention in the book :S)

When I gave the table name as below:

it still behaved like AUTO, even though I have the table this time in my database as

+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| id_gen | varchar(100) | NO | PRI | | |
| key_value | int(11) | YES | | NULL | |
+-----------+--------------+------+-----+---------+-------+

Please clarify as the behavior is not clear to me.
I came across this while trying to code the examples in the book and when they did not work as expected (Used Hibernate and MySQL) .

Please help me with the problem and let me know if further details required.

Thanks
 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any replies?
I think I have provided the complete details, still if further information required please reply.

 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is my question missing any details?
If not, why no answers yet?
 
Greenhorn
Posts: 12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sudhanshu Mishra,

Although you created a valid generator, you still need to override the default generation strategy, as follows:



There's no need for pushing anyone for answers, alright?!
 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply,Rafael de Sousa
If you read the question completly, I also referred that it was mentioned in the Pro JPA 2 book.
Thanks for helping me get this straight though.
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!